问题遇到的现象和发生背景
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.
遇到的现象和发生背景
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,输入也好,子函数也好,都没有用。
想知道解决方法。