Browse Source

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

GitOrigin-RevId: 4f61e5b544
tags/v1.7.0.m1
Megvii Engine Team 3 years ago
parent
commit
8f2e2711ea
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      lite/pylite/megenginelite/tensor.py

+ 2
- 1
lite/pylite/megenginelite/tensor.py View File

@@ -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
):


Loading…
Cancel
Save