提交 8f2e2711 编写于 作者: M Megvii Engine Team

fix(pylite): add dtype to empty tensor to_numpy api

GitOrigin-RevId: 4f61e5b544e1a52ed7ddf9abf15c042ac3465bb6
上级 02d5f46d
......@@ -421,7 +421,8 @@ class LiteTensor(object):
"""
self.update()
if self.nbytes <= 0:
return np.array([])
np_type = _lite_type_to_nptypes[LiteDataType(self._layout.data_type)]
return np.array([], dtype=np_type)
if self.is_continue and (
self.is_pinned_host or self.device_type == LiteDeviceType.LITE_CPU
):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册