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

Function PyTensorObject_set_data

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

Source from the content-addressed store, hash-verified

628}
629
630static 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
641static PyObject* PyTensorObject_ref_tensor(PyObject* self, void* unused) {
642 HANDLE_ERRORS

Callers

nothing calls this directly

Calls 3

RegisterTensorHookFunction · 0.85
autograd_metaMethod · 0.45
set_dataMethod · 0.45

Tested by

no test coverage detected