pytorch
7747fe81 - reuse named tensor error message in generated code (#33536)

Commit
6 years ago
reuse named tensor error message in generated code (#33536) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/33536 Simple fix, merge the identical string literals that were being inlined into every wrapper for ops that don't support named tensors. E.g. ``` Tensor all(const Tensor & self, int64_t dim, bool keepdim) { if (self.has_names()) { AT_ERROR( "all is not yet supported with named tensors. Please drop names via " "`tensor = tensor.rename(None)`, call the op with an unnamed tensor, " "and set names on the result of the operation."); } const OptionalDeviceGuard device_guard(device_of(self)); return at::native::all(self, dim, keepdim); } ``` becomes ``` Tensor all(const Tensor & self, int64_t dim, bool keepdim) { if (self.has_names()) { AT_ERROR("all", named_tensors_unsupported_error); } const OptionalDeviceGuard device_guard(device_of(self)); return at::native::all(self, dim, keepdim); } ``` Also updated the generated file comments to include the source template names, e.g. ``` // generated by aten/src/ATen/gen.py from TypeDefault.cpp ``` Test Plan: Imported from OSS Differential Revision: D19993407 Pulled By: bhosmer fbshipit-source-id: 88395a649e6ba53191332344123555c217c5eb40
Author
Basil Hosmer
Parents
Loading