欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

runtimeerror: output 0 of unbindbackward is a view and is being modified inplace.

程序员文章站 2022-03-04 14:17:27
...

 

portch ResNet 中间层可视化出现的错误记录

主要原因:

       调用了make_grid()

根因:

      Lib\site-packages\torchvision\utils.py

74 行 for t in tensor:     

改成 

for idx, _ in enumerate([jj for jj in tensor]):
    t = tensor[idx]

有些说是下面这种,其实也不对

for i in range(tensor.size(0)):  # loop over mini-batch dimension
    t = tensor[i]

【参考】

https://github.com/pytorch/vision/issues/3025