pytorch
528ee0fa - Fix composite compliance testing to check for .item() calls (#81060)

Commit
3 years ago
Fix composite compliance testing to check for .item() calls (#81060) Composite compliance is supposed to check if a composite function calls .item() ([ref](https://github.com/pytorch/pytorch/blob/39db8b3823b8db82396cb979105a83e5e137a02f/torch/testing/_internal/composite_compliance.py#L135-L138)). This PR fixes that and adds some more documentation. Why do we need this check? The original motivations are that Tensor subclasses may not support .item calls (e.g. vmap and ProxyTensor). There is no way for these subclasses to meaningfully override the .item() calls in composite functions that exist inside the PyTorch framework without raising an error* so we should aim to rewrite composite operations to not call .item(). *We're open to other solutions, this is just the one we decided on when we wrote composite compliance testing and these tests help us keep track of the failing functionality. Test Plan: - wait for tests Pull Request resolved: https://github.com/pytorch/pytorch/pull/81060 Approved by: https://github.com/ezyang
Author
Committer
Parents
Loading