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

原因:0.4.0把Varible和Tensor融合为一个Tensor,inplace操作,之前对Varible能用,但现在对Tensor,就会出错了,所以找到模型中所有的inplace操作,换成非inplace的写法就行

参考:https://blog.csdn.net/DuinoDu/article/details/80435127

RuntimeError: cuda runtime error (59) : device-side assert triggered at /pytorch/aten/src/THC/THCTensorCopy.cu:102

/pytorch/torch/lib/THCUNN/ClassNLLCriterion.cu:101: void cunn_ClassNLLCriterion_updateOutput_kernel(Dtype *, Dtype *, Dtype *, long *, Dtype *, int, int, int, int, long) [with Dtype = float, Acctype = float]: block: [0,0,0], thread: [3,0,0] Assertion t >= 0 && t < n_classes failed.

原因:有可能是最后一层的layer的参数num_labels不对,导致GPU跑的时候出错

参考:https://github.com/pytorch/pytorch/issues/10303

 

相关文章:

  • 2021-07-12
  • 2021-07-12
  • 2021-09-12
  • 2021-12-21
  • 2021-11-10
  • 2022-12-23
  • 2021-12-04
  • 2021-11-26
猜你喜欢
  • 2021-05-02
  • 2021-12-17
  • 2022-12-23
  • 2021-11-15
  • 2021-07-01
  • 2022-12-23
  • 2021-07-16
相关资源
相似解决方案