MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / PyTensorObject_register_hook

Function PyTensorObject_register_hook

oneflow/api/python/framework/tensor.cpp:369–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369static PyObject* PyTensorObject_register_hook(PyObject* self, PyObject* hook) {
370 HANDLE_ERRORS
371 const auto& _hook = py::cast<AutogradMeta::Hook>(py::reinterpret_borrow<py::object>(hook));
372 ASSERT(RegisterTensorHook(PyTensor_Unpack(self), _hook));
373 Py_RETURN_NONE;
374 END_HANDLE_ERRORS
375}
376
377static PyObject* PyTensorObject__register_post_grad_accumulation_hook(PyObject* self,
378 PyObject* hook) {

Callers

nothing calls this directly

Calls 1

RegisterTensorHookFunction · 0.85

Tested by

no test coverage detected