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

Function np2tensor

imperative/python/src/helper.cpp:653–663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

651}
652
653HostTensorND np2tensor(PyObject* obj, const Meth& meth, DType dtype) {
654 auto ret_full = np2tensor_try_borrow(obj, meth, dtype);
655 if (meth.must_borrow_) {
656 mgb_assert(
657 ret_full.second,
658 "can not borrow from numpy array as contig array with dtype "
659 "%s; src=%s",
660 dtype.name(), repr_pyobj(obj).c_str());
661 }
662 return ret_full.first;
663}
664
665PyObject* dtype_mgb2np(mgb::DType dtype) {
666 PYTHON_GIL;

Callers 6

init_graph_rtFunction · 0.85
py_applyFunction · 0.85
pyarr2hvalFunction · 0.85
init_commonFunction · 0.85
get_res_by_refhdlFunction · 0.85
init_opsFunction · 0.85

Calls 3

np2tensor_try_borrowFunction · 0.85
repr_pyobjFunction · 0.85
nameMethod · 0.45

Tested by

no test coverage detected