当前位置:   article > 正文

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace o

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace o

错误:

您在 pytorch 中遇到如下错误。

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor []], which is output 0 of SelectBackward, is at version 4; expected version 3 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient.

这意味着你使用张量或其部分来计算同一张量的一部分。下面的代码演示了这个错误。

  1. import pytorch3d.transforms
  2. import torch
  3. euler_angles = torch.nn.Parameter(torch.Tensor([0.1, 0.03,-0.2]))
  4. target = torch.eye(3)
  5. torch
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/404530
推荐阅读
  

闽ICP备14008679号