@@ -54,7 +54,7 @@ def _convert_to_num(dt, arr):
54
54
if isinstance (obj , list ):
55
55
_convert_to_num (obj )
56
56
else :
57
- if dt in (DType .float . value , DType .double . value ):
57
+ if dt in (DType .float , DType .double ):
58
58
arr [ix ] = float (obj )
59
59
else :
60
60
arr [ix ] = int (obj )
@@ -159,6 +159,8 @@ def to_numpy(self):
159
159
160
160
@staticmethod
161
161
def _to_numpy_type (t ):
162
+ if isinstance (t , DType ):
163
+ t = t .value
162
164
mm = {
163
165
'FLOAT' : 'float32' ,
164
166
'DOUBLE' : 'float64'
@@ -237,10 +239,11 @@ def tensorget(self, key, as_type=Tensor, meta_only=False):
237
239
argname = 'META' if meta_only else as_type .ARGNAME
238
240
res = self .execute_command ('AI.TENSORGET' , key , argname )
239
241
dtype , shape = to_string (res [0 ]), res [1 ]
242
+ dt = DType .__members__ [dtype .lower ()]
240
243
if meta_only :
241
- return as_type (dtype , shape , [])
244
+ return as_type (dt , shape , [])
242
245
else :
243
- return as_type .from_resp (dtype , shape , res [2 ])
246
+ return as_type .from_resp (dt , shape , res [2 ])
244
247
245
248
def scriptset (self , name , device , script ):
246
249
return self .execute_command ('AI.SCRIPTSET' , name , device .value , script )
0 commit comments