Torch.bmm will break the gradient?RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

Hi, all
My code like this:
return output
where l_atten is obtained from l_feature according to a NNs
So both l_feature and l_atten need backward.

1 Like

Can you format your code and text properly? If you do not want to show your effort in trying to solve your problem, no one will. If you do not know how to use Markdown, see tutorial here.