| 651 | } |
| 652 | |
| 653 | HostTensorND 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 | |
| 665 | PyObject* dtype_mgb2np(mgb::DType dtype) { |
| 666 | PYTHON_GIL; |
no test coverage detected