pytorch
160946e3 - Use `torch.empty()` instead of `torch.tensor()` in `torch.nn.Parameter` (#66486)

Commit
3 years ago
Use `torch.empty()` instead of `torch.tensor()` in `torch.nn.Parameter` (#66486) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/66486 The newly-introduced Python dispatcher mode (`__torch_dispatch__`) does not have support for `torch.tensor()` (see #64360) and this causes friction in the user experience if some `nn.Modules` use `torch.tensor()` either implicitly or explicitly. This PR replaces calls to `torch.tensor()` in `Parameter`, `UninitializedParameter`, and `UninitializedBuffer` with an equivalent call to `torch.empty()` which serves the same purpose and is syntactically more readable. ghstack-source-id: 140520931 Test Plan: Since no behavioral change, run the existing unit and integration tests. Reviewed By: pbelevich Differential Revision: D31575587 fbshipit-source-id: bd7bdeea54370f3e53dc13bd182b97d0f67146f5
Author
Parents
Loading