train using Pytorch1.8.0
rebecca0011 opened this issue · 4 comments
I am a freshman.
I use Pytorch1.8.0 but got this error, but do not know how to fix...
Traceback (most recent call last): File "main.py", line 201, in <module> train() File "main.py", line 101, in train loss, scalar_outputs, image_outputs = train_sample(sample, compute_metrics=do_summary) File "main.py", line 159, in train_sample image_outputs["errormap"] = [disp_error_image_func()(disp_est, disp_gt) for disp_est in disp_ests] File "main.py", line 159, in <listcomp> image_outputs["errormap"] = [disp_error_image_func()(disp_est, disp_gt) for disp_est in disp_ests] File "/home/rc/anaconda3/envs/DL/lib/python3.7/site-packages/torch/autograd/function.py", line 262, in __call__ "Legacy autograd function with non-static forward method is deprecated. " RuntimeError: Legacy autograd function with non-static forward method is deprecated. Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)
我也是这个问题,请问你解决没?
我也是这个问题,请问有解决的吗
你好 这个问题最后得到解决了吗
I solve this problem, and the code works in pytorch 1.13.0. Here is my solution.
- go to utils/visualization.py. In class disp_error_image_func, add @staticmethod before forward and backward function
- go to main.py. change [disp_error_image_func()(disp_est, disp_gt) for disp_est in disp_ests] to [disp_error_image_func().apply(disp_est, disp_gt) for disp_est in disp_ests] in test_sample and train_sample function
But I don't know if this modification will affect the final result.