@@ -54,7 +54,7 @@ def _convert_to_num(dt, arr):
5454 if isinstance (obj , list ):
5555 _convert_to_num (obj )
5656 else :
57- if dt in (DType .float . value , DType .double . value ):
57+ if dt in (DType .float , DType .double ):
5858 arr [ix ] = float (obj )
5959 else :
6060 arr [ix ] = int (obj )
@@ -159,6 +159,8 @@ def to_numpy(self):
159159
160160 @staticmethod
161161 def _to_numpy_type (t ):
162+ if isinstance (t , DType ):
163+ t = t .value
162164 mm = {
163165 'FLOAT' : 'float32' ,
164166 'DOUBLE' : 'float64'
@@ -237,10 +239,11 @@ def tensorget(self, key, as_type=Tensor, meta_only=False):
237239 argname = 'META' if meta_only else as_type .ARGNAME
238240 res = self .execute_command ('AI.TENSORGET' , key , argname )
239241 dtype , shape = to_string (res [0 ]), res [1 ]
242+ dt = DType .__members__ [dtype .lower ()]
240243 if meta_only :
241- return as_type (dtype , shape , [])
244+ return as_type (dt , shape , [])
242245 else :
243- return as_type .from_resp (dtype , shape , res [2 ])
246+ return as_type .from_resp (dt , shape , res [2 ])
244247
245248 def scriptset (self , name , device , script ):
246249 return self .execute_command ('AI.SCRIPTSET' , name , device .value , script )
0 commit comments