为什么前向法火炬自动加载功能必须是stati

2024-09-28 22:58:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我收到警告说

/tmp/pip-req-build-58y_cjjl/torch/csrc/autograd/python_function.cpp:638: UserWarning: Legacy autograd function with non-static forward method is deprecated and will be removed in 1.3.
 Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)
/tmp/pip-req-build-58y_cjjl/torch/csrc/autograd/python_function.cpp:664: UserWarning: Legacy autograd function object was called twice.  You will probably get incorrect gradients from
 this computation, as the saved tensors from the second invocation will clobber the saved tensors from the first invocation.  Please consider rewriting your autograd function in the m
odern style; for information on the new format, please see: https://pytorch.org/docs/stable/notes/extending.html#extending-torch-autograd

这意味着我必须在Pythorch 1.3或更高版本中定义静态转发函数。
我只是想知道为什么自动加载功能一定是静态的?在


Tags: pipthefrombuildlegacyfunctiontorchreq