Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update impl_abstract_pystub to be less boilerplatey
Summary: X-link: pytorch/pytorch#112851 We've made the following changes: - The new way to use the API is `m.impl_abstract_pystub(module, context)`. Every subsequent m.def of an op inside the TORCH_LIBRARY block gives the op the `impl_abstract_pystub`. - Added a mechanism to determine if an operator was defined in Python or C++. Library.define in Python appends the op to a global set, which is analogous to what we do for tracking Library.impl. - If someone does `torch.library.impl_abstract` in Python for an operator, then we require that it has an `impl_abstract_pystub` specified and we also check that the module in the `impl_abstract_pystub` is the same as the module where the call to `torch.library.impl_abstract` exists. - Unfortunately we can't check the "context" (which is the buck target on buck-based systems) because buck sits above us. bypass-github-export-checks Reviewed By: ezyang Differential Revision: D50972148 fbshipit-source-id: 34ab31493d9bccd0d351b463cfb508ba0b05eef4
- Loading branch information