Thanks for ur help, lambda i:i  really work!!!
Say the batch size = 8, by using this method I have to iterate these 8 data seperately and add the loss???
And also Is it be able to use lambda i:i with dataparallel?