File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -808,14 +808,18 @@ static PyObject* THPVariable_make_dtensor(
808
808
" cls must be a type (got " ,
809
809
Py_TYPE (cls)->tp_name ,
810
810
" )" );
811
- // See note about the __torch_dispatch__ check in
812
- // THPVariable_make_wrapper_subclass above.
811
+
812
+ #ifndef NDEBUG
813
+ // This is specifically for making a DTensor, which we know defines
814
+ // __torch_dispatch__. Check anyway in debug builds in case somebody
815
+ // removes it.
813
816
py::object attr = PyObject_FastGetAttrString (cls, " __torch_dispatch__" );
814
817
TORCH_CHECK_TYPE (
815
818
attr.ptr () != nullptr &&
816
819
attr.ptr () != torch::disabled_torch_dispatch_impl (),
817
820
((PyTypeObject*)cls)->tp_name ,
818
821
" must define __torch_dispatch__" );
822
+ #endif
819
823
820
824
const auto & local_tensor = r.tensor (3 );
821
825
const auto options = TensorOptions ()
You can’t perform that action at this time.
0 commit comments