-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[C++ API] Add backward() to Tensor and Variable #7750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@pytorchbot retest this please |
apaszke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Splitting namespaces into multiple lines is really unnecessary. Such changes don't add any value to our code, and really make it less consistent. Please don't include such changes in the future, unless we establish a code format policy, and will do a full codebase refactor.
torch/csrc/autograd/variable.cpp
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/autograd/variable.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/autograd/variable.cpp
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
FYI, according to GitHub this was merged without CI going green. Even after the subsequent fix, Windows is still failing (#7762). |
This reverts commit 1e27627.
|
Yeah I pushed a quick two line formatting fix after everything was already green, and merged it immediately. The formatting fix had the missing braces |
…e2_core_hip * 'caffe2_core_hip' of github.com:petrex/pytorch: (24 commits) Allow empty storage for the 'Edge' class. (pytorch#7595) Process group base class and Gloo implementation (pytorch#7628) _LRSchedulers getstate include optimizer info (pytorch#7757) [PyTorch] [gradcheck] change backward() to grad() (pytorch#7710) Update test_nn.py (pytorch#7787) Define general default scheduler for TBB and fix ppc64le bug (pytorch#7761) Add support for accepting Tensor as input in clip_grad_* functions. (pytorch#7769) [Easy] Remove unused code (pytorch#7782) Update tbb (pytorch#7734) Add @generated annotation (pytorch#7780) fix legacy comment after variable tensor merge (pytorch#7771) Revert pytorch#7750 and pytorch#7762 to fix Windows CI on master (pytorch#7772) Temporarily disable build env check (pytorch#7768) Add missing brace (pytorch#7762) [C++ API] Add backward() to Tensor and Variable (pytorch#7750) [auto] Update onnx to d43b550 - Fix .gitignore and add missing files (onnx/onnx#1005) onnx/onnx@d43b550 [auto] Update onnx to ea1aa13 - add tests for reduce ops (onnx/onnx#675) onnx/onnx@ea1aa13 include cudnn_h (pytorch#7749) [C++ API] Using new registration mechanism (pytorch#7663) [auto] Update onnx to 5dd68e6 - Add a util function: polish_model (onnx/onnx#1000) onnx/onnx@5dd68e6 ...
* Add backward() to Tensor and Variable * Added a couple tests
…orch#7772) * Revert "Add missing brace (pytorch#7762)" This reverts commit ea27c5a. * Revert "[C++ API] Add backward() to Tensor and Variable (pytorch#7750)" This reverts commit 1e27627.

A sort of small and uncomplicated change, but nice for the C++ world: adds
backward()to the "autograd API" ofat::Tensorand implements it forVariableImplto execute the default autograd engine on the variable.Main code is in
autograd/variable.cpp.I've removed the equivalent free function from autogradpp.
@zdevito @colesbury @apaszke @ebetica