so thanks to u
u are right , the error  caused by  the last batch could be smaller than the other ones
on the other hand i found some new questions want to ask u,
in my code  the b1,b2 is the  ‘’ for loop " s  local variable,
should i set them  as the Variable tensor in cuda before my network is working?
e.g.  :  b1=torch.randn(2,24)
b1=Variable(b1)
b1=b1.cuda()
another question  is:
i use split and cat  to achieve “2x24 -->2X8”
i mean the split and cat seems like not a basic mathematical operations
so when the back propagation is running , it looks like the grad update will be effected?
last one is:
i want to use the 2x24 vector get my loss1  and use the 2X8 vector get my loss2,
so the code for the part of  "2X24 turn to 2X8 " should put in my  network 's  def forward
or in my every train epoch
(i mean the network just return the 2X24 and get 2X8 ,loss1,loss2 in the training
or the network return the 2X24 ,2X8 and get loss1,loss2 in the training  )
Thank you very much for helping me