Почему форвард метод torch.autograd.Function должна быть статической - PullRequest
0 голосов
/ 07 ноября 2019

Я получил предупреждение, что

/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 или более поздней версии.
Мне просто интересно, почему метод пересылки autograd.Function должен быть статическим?

...