pytorch
580a0538 - [primTorch] Enforces stride metadata (#77542)

Commit
2 years ago
[primTorch] Enforces stride metadata (#77542) This PR... **Filed the Following Issues** - https://github.com/pytorch/pytorch/issues/77553 - https://github.com/pytorch/pytorch/issues/77526 - https://github.com/pytorch/pytorch/issues/77600 **Testing** - Updates test_dtypes to longer attempt to test the backward of sample inputs where no inputs require grad - Adds a new test_python_reference_errors; it ensures the meta operations for references throw errors as expected - Updates compare_tensor_meta to better handle CUDA devices, and (temporarily) restricts stride checking to the CUDA device type - Elementwise unary and elementwise binary operators now have arbitrarily strided reference inputs - Reference inputs for _like functions are added - An OpInfo for torch.empty is added - Reference inputs for torch.clone are added - A NumPy reference for clone is added - Adds OpInfos for refs.empty and refs.empty_like **Prims** - Renames the "max" and "min" prims have been renamed to "maximum" and "minimum," respectively, to better conform to their ATen names - Adds the empty, empty_like, full, and full_like prims - Fixes the elementwise meta function's stride propagation - Fixes clone's meta function's stride propagation - Fixes convert_element_type's meta's stride propagation - Adds a (temporary) _to_dtype pprivate prim that casts a tensor while preserving its stride permutation - Removes the _set prim comment - Adds utils.compute_elementwise_output_strides, which computes the correct output strides for elementwise operations - Corrects an issue where utils.make_contiguous_strides_for was creating the incorrect strides for tensors with no elements **References** - Adds the empty, empty_like, full, full_like, and ones_like refs - Extends make_elementwise_unary_reference to accept an additional callable to perform extra input validation - Adds an extra validation function to handle refs.neg(BoolTensor) - Updates the isfinite ref to call ones_like when appropriate - Models Python scalar handling for elementwise binary operations - Added a 64 dim check for the amin and amax references - opmath is now a flag that can be set separately for cpu and CUDA Pull Request resolved: https://github.com/pytorch/pytorch/pull/77542 Approved by: https://github.com/ezyang
Author
Mike Ruberry
Committer
Parents
Loading