Solved by Naman-ntc in post #2 
              
              
                suppose you forward pass on  6 datapoints (6 images) and you want to perform GD on 36 datapoints (images) 
Let dataloader load input with dimension [6x3x224x224] then 
for i,(input,target) in enumerate(dataloader):
    output = model(input)
    loss = lossfn(output, target)
    loss.backward() #Only…