I have a question.
For pytorch0.3.0s.
(I)I use the following code:
total_loss = net([batch_size, input_size]) #means all batch_size train samples
total_loss.backward()
optimizer.step()
(II)I use the following code:
total_loss = 0
for i in range(batch_size):
loss = net([(i)input_size]) #means i train sample
totle_loss += loss/batch_size
total_loss.backward()
optimizer.step()
Can you tell me any differences between (I) and (II), that means I use “for loop” to throw input to neural network step by step, and I want to know the final results is different? or maybe only training time is longer.