| 104 | friend wrap_t; |
| 105 | |
| 106 | inline static TensorWrapper* cast(PyObject* obj) { |
| 107 | return reinterpret_cast<wrap_t*>(obj)->inst(); |
| 108 | } |
| 109 | inline static TensorWrapper* try_cast(PyObject* obj) { |
| 110 | if (!wrap_t::type().isinstance(obj)) |
| 111 | return nullptr; |