| 628 | } |
| 629 | |
| 630 | static int PyTensorObject_set_data(PyObject* self, PyObject* data, void* unused) { |
| 631 | HANDLE_ERRORS |
| 632 | const auto& t = PyTensor_Unpack(self); |
| 633 | auto hooks = t->autograd_meta()->hooks(); |
| 634 | ASSERT(t->set_data(PyTensor_Unpack(data))); |
| 635 | // Re-register hooks |
| 636 | for (const auto& hook : hooks) { ASSERT(RegisterTensorHook(t, hook)); } |
| 637 | return 0; |
| 638 | END_HANDLE_ERRORS_RET(-1) |
| 639 | } |
| 640 | |
| 641 | static PyObject* PyTensorObject_ref_tensor(PyObject* self, void* unused) { |
| 642 | HANDLE_ERRORS |
nothing calls this directly
no test coverage detected