I am trying to model an image classification problem using convolution neural network. I came across a code on Github in which I am not able to understand the meaning of following line for loss calculation in the training loop.
I am omitting most of the detail and only placing the relevent code-
for batch_idx, (data, target) in enumerate(final_train_loader):
loss = criterion(output,target)
#Idea behind the below line
train_loss = train_loss + ((1 / (batch_idx + 1)) * (loss.data - train_loss))
Cross-entropy loss function is being used here.