# \[Solved\]\[Pytorch1.5\] RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

**URL:** <https://discuss.pytorch.org/t/solved-pytorch1-5-runtimeerror-one-of-the-variables-needed-for-gradient-computation-has-been-modified-by-an-inplace-operation/90256>\
**Category:** autograd\
**Created:** [July 23, 2020, 9:52am UTC](https://discuss.pytorch.org/t/solved-pytorch1-5-runtimeerror-one-of-the-variables-needed-for-gradient-computation-has-been-modified-by-an-inplace-operation/90256 "2020-07-23T09:52:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![albanD](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alband/32/215_2.png) [@albanD](https://discuss.pytorch.org/u/albanD)\
**Post date:** [July 23, 2020, 2:44pm UTC](https://discuss.pytorch.org/t/solved-pytorch1-5-runtimeerror-one-of-the-variables-needed-for-gradient-computation-has-been-modified-by-an-inplace-operation/90256/2 "2020-07-23T14:44:11Z")

</div>

Hi,

This is most likely happening because `value_optimizer.step()` actually modifies the weights of the model inplace while the original value of these weights is needed to compute `action_loss.backward()`.  
Is that the issue?

---

_[View the full topic](https://discuss.pytorch.org/t/solved-pytorch1-5-runtimeerror-one-of-the-variables-needed-for-gradient-computation-has-been-modified-by-an-inplace-operation/90256)._
