Reland "Trigger specialization when you call size()/stride() from C++ (#111935)" (#112605)

This reverts commit 22221c6d60613e498aa67b7f7f0f83ec97e35b8a.

Differential Revision: [D50886564](https://our.internmc.facebook.com/intern/diff/D50886564)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/112605
Approved by: https://github.com/voznesenskym
This commit is contained in:
Edward Z. Yang
2023-11-01 11:40:49 -04:00
committed by PyTorch MergeBot
parent 68dead4a6c
commit a1ab22b81d
6 changed files with 29 additions and 13 deletions

View File

@ -811,6 +811,10 @@ void initDispatchBindings(PyObject* module) {
c10::make_intrusive<c10::ConstantSymNodeImpl<bool>>(data));
});
m.def("_non_sym_sizes", [](const at::Tensor& a) {
return a.sizes(); // NB: NOT sym_size
});
using c10::impl::TorchDispatchModeKey;
py::enum_<TorchDispatchModeKey>(m, "_TorchDispatchModeKey")
.value("FUNCTIONAL", TorchDispatchModeKey::FUNCTIONAL)