I solved the first error with add the Variable out of the arr,because the arr we built is a tensor ,but in the process of forward the tensor we should change into the Variable.
yes,we would return the mx in the forward function,how to pick out the element from the tensor (2,3)and count the loss.
now, i plan to use a mask tensor like[[1,0,0],[0,0,0]] and mul with the mk in the custom loss function and then use a sun() to get the element. Is this method effective？