Python 为什么torch.autograd.Function的正向方法必须是静态的

Python 为什么torch.autograd.Function的正向方法必须是静态的,python,neural-network,deep-learning,pytorch,static-methods,Python,Neural Network,Deep Learning,Pytorch,Static Methods,我得到警告说 /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

我得到警告说

/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
这意味着我必须在pytorch 1.3或更高版本中定义静态转发功能。
我只是想知道为什么自动加载的正向方法。函数必须是静态的

我想这应该对你有帮助。