MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / reset

Method reset

imperative/python/src/tensor.cpp:721–727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

719}
720
721void TensorWrapper::reset(PyObject* tensor) {
722 TensorWrapper* t = TensorWrapper::try_cast(tensor);
723 if (!t) {
724 throw py::type_error("expect Tensor");
725 }
726 m_tensor->reset(t->m_tensor->data());
727}
728
729PyObject* TensorWrapper::detach() {
730 auto detached = imperative::apply(DetachGrad(), m_tensor->data())[0];

Callers 9

TensorWrapperMethod · 0.45
init_tensorFunction · 0.45
exitMethod · 0.45
np2tensor_try_borrowFunction · 0.45
from_dlpackMethod · 0.45
attachMethod · 0.45
exitMethod · 0.45
py_dealloc_genericFunction · 0.45

Calls 2

try_castFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected