Make IValue::unsafeToTensorImpl a little less unsafe. (#88043)

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88043
Approved by: https://github.com/anjali411, https://github.com/albanD
This commit is contained in:
Edward Z. Yang 2022-10-29 21:43:09 -04:00 committed by PyTorch MergeBot
parent e238752e20
commit 8ea19c802e

View File

@ -425,6 +425,7 @@ public:
at::Tensor& toTensor() &;
const at::Tensor& toTensor() const&;
at::TensorImpl* unsafeToTensorImpl() const {
TORCH_INTERNAL_ASSERT(isTensor());
return payload.as_tensor.unsafeGetTensorImpl();
}