提交 9eb4ba88 编写于 作者: M Megvii Engine Team

perf(tensor): always copy to pinned memory before h2d

GitOrigin-RevId: f945f2435f5a29a03610a04a47f5d7c1a4562b97
上级 4d9073fc
......@@ -271,10 +271,7 @@ TensorWrapper::TensorWrapper(PyObject* args, PyObject* kwargs) {
}
interpreter::Interpreter::Handle handle;
constexpr auto size_threshhold = TensorShape::MAX_NDIM;
if (data.size() > size_threshhold) {
handle = interpreter_for_py->put(npy::np2tensor(data.ptr(), npy::Meth::borrow(cn), dtype), no_cache);
} else {
{
HostTensorND ret(cn);
handle = interpreter_for_py->put(npy::np2tensor(data.ptr(), npy::Meth::copy_into(&ret), dtype), no_cache);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册