Fix autograd engine checks and update InputMetadata#65235
Fix autograd engine checks and update InputMetadata#65235anjali411 wants to merge 8 commits intogh/anjali411/137/basefrom
Conversation
[ghstack-poisoned]
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 1fe42fd (more details on the Dr. CI page):
ci.pytorch.org: 1 failedThis comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions to the (internal) Dr. CI Users group. |
[ghstack-poisoned]
[ghstack-poisoned]
|
I'm letting Alban do full review on this. |
1. Updated the legacy type checks in `torch/csrc/autograd/engine.cpp` to individually validate the dtype, device, and layout equality for grad and tensor. 2. Removed device field from `InputMetadata` since it's already stored via storing options. Also, added `dtype()` and `layout()` methods to `InputMetadata`. To make this change, some calls had to be updated due to the change in constructor. 3. To fix #65016: a. Added a `is_tensor_subclass` field in `InputMetadata` to skip device checks for grad and tensor when the tensor has python key set on it (tensor subclass). [ghstack-poisoned]
1. Updated the legacy type checks in `torch/csrc/autograd/engine.cpp` to individually validate the dtype, device, and layout equality for grad and tensor. 2. Removed device field from `InputMetadata` since it's already stored via storing options. Also, added `dtype()` and `layout()` methods to `InputMetadata`. To make this change, some calls had to be updated due to the change in constructor. 3. To fix #65016: a. Added a `is_tensor_subclass` field in `InputMetadata` to skip device checks for grad and tensor when the tensor has python key set on it (tensor subclass). [ghstack-poisoned]
albanD
left a comment
There was a problem hiding this comment.
sgtm just the continue thing
1. Updated the legacy type checks in `torch/csrc/autograd/engine.cpp` to individually validate the dtype, device, and layout equality for grad and tensor. 2. Removed device field from `InputMetadata` since it's already stored via storing options. Also, added `dtype()` and `layout()` methods to `InputMetadata`. To make this change, some calls had to be updated due to the change in constructor. 3. To fix #65016: a. Added a `is_tensor_subclass` field in `InputMetadata` to skip device checks for grad and tensor when the tensor has python key set on it (tensor subclass). [ghstack-poisoned]
|
@anjali411 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
1. Updated the legacy type checks in `torch/csrc/autograd/engine.cpp` to individually validate the dtype, device, and layout equality for grad and tensor. 2. Removed device field from `InputMetadata` since it's already stored via storing options. Also, added `dtype()` and `layout()` methods to `InputMetadata`. To make this change, some calls had to be updated due to the change in constructor. 3. To fix #65016: a. Added a `is_tensor_subclass` field in `InputMetadata` to skip device checks for grad and tensor when the tensor has python key set on it (tensor subclass). Differential Revision: [D31082693](https://our.internmc.facebook.com/intern/diff/D31082693) [ghstack-poisoned]
|
@anjali411 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
@anjali411 merged this pull request in 9324d68. |
|
This pull request has been reverted by 152f023. |
1. Updated the legacy type checks in `torch/csrc/autograd/engine.cpp` to individually validate the dtype, device, and layout equality for grad and tensor. 2. Removed device field from `InputMetadata` since it's already stored via storing options. Also, added `dtype()` and `layout()` methods to `InputMetadata`. To make this change, some calls had to be updated due to the change in constructor. 3. To fix #65016: a. Added a `is_tensor_subclass` field in `InputMetadata` to skip device checks for grad and tensor when the tensor has python key set on it (tensor subclass). Differential Revision: [D31082693](https://our.internmc.facebook.com/intern/diff/D31082693) [ghstack-poisoned]
|
@anjali411 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
I would say no since I don't think we plan to have broad subclassing support in 1.10 anyways? |
Stack from ghstack:
torch/csrc/autograd/engine.cppto individually validate the dtype, device, and layout equality for grad and tensor.InputMetadatasince it's already stored via storing options. Also, addeddtype()andlayout()methods toInputMetadata. To make this change, some calls had to be updated due to the change in constructor.a. Added a
is_tensor_subclassfield inInputMetadatato skip device checks for grad and tensor when the tensor haspython key set on it (tensor subclass).
Differential Revision: D31117318