AutoEchoes 2022-12-27 11:22 采纳率: 0%
浏览 1821

RuntimeError: Inplace update to inference tensor outside InferenceMode is not allowed

问题遇到的现象和发生背景

pytorch出现报错
RuntimeError: Inplace update to inference tensor outside InferenceMode is not allowed.You can make a clone to get a normal tensor before doing inplace update.See https://github.com/pytorch/rfcs/pull/17 for more details.

img

遇到的现象和发生背景

pytorch的meganerf开源程序,在win平台运行,报错运行不了。

程序

1.调用块程序:

val_psnr = psnr(eval_result_rgbs.view(-1, 3), eval_rgbs.view(-1, 3))

2.子函数程序

def psnr(rgbs: torch.Tensor, target_rgbs: torch.Tensor) -> float:
    mse = torch.mean((rgbs - target_rgbs) ** 2)
    return -10 * torch.log10(mse).item()
我的解答思路和尝试过的方法

查找网址后,没找到方法;
尝试自己加上.clone,输入也好,子函数也好,都没有用。
想知道解决方法。

  • 写回答

4条回答 默认 最新

  • nicole2328 2023-03-07 16:57
    关注

    我也遇到这个问题,请问找到解决方法了吗

    评论

报告相同问题?

问题事件

  • 创建了问题 12月27日