Hi,
Two things:

What version of pytorch are you using?
This kind of errors during the backward pass comes from the fact that you modified a Tensor inplace during the forward pass, and this tensor was necessary for backpropagation. As stated by @SpandanMadan we need more context to help you in this case.