pytorch
6d7bc34b - Make new_empty/new_ones/new_zeros/new_full respect subclass (#65169)

Commit
3 years ago
Make new_empty/new_ones/new_zeros/new_full respect subclass (#65169) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/65169 Previously these composite functions created a new tensor using at::empty (or some other factory function) using TensorOptions which doesn't preserve Python subclass. Making new_empty a non-composite op and then routing everyone through it makes it respect subclass. We could also make all of these non-composite but this reduces the number of derivatives.yaml entries I have to make and allows you to trace the fill calls. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Test Plan: Imported from OSS Reviewed By: albanD Differential Revision: D31003713 Pulled By: ezyang fbshipit-source-id: 19f906f1404a6b724769c49f48d123f407a561ff
Author
Parents
Loading