3434try :
3535 from hip ._util .types import DeviceArray
3636except ImportError :
37- Pointer = Exception # using Exception here as a type that will never be among kernel arguments
37+ Pointer = Exception # using Exception here as a type that will never be among kernel arguments
3838 DeviceArray = Exception
3939
4040
@@ -160,22 +160,21 @@ def ready_argument_list(self, arguments):
160160
161161 for i , arg in enumerate (arguments ):
162162 if not (isinstance (arg , (np .ndarray , np .number , DeviceArray )) or is_cupy_array (arg )):
163- raise TypeError (f"Argument is not numpy or cupy ndarray or numpy scalar or HIP Python DeviceArray but a { type (arg )} " )
163+ raise TypeError (
164+ f"Argument is not numpy or cupy ndarray or numpy scalar or HIP Python DeviceArray but a { type (arg )} "
165+ )
164166 dtype_str = arg .typestr if isinstance (arg , DeviceArray ) else str (arg .dtype )
165167 if isinstance (arg , np .ndarray ):
166168 if dtype_str in dtype_map .keys ():
167169 data_ctypes = arg .ctypes .data_as (C .POINTER (dtype_map [dtype_str ]))
168- numpy_arg = arg
169170 else :
170171 raise TypeError ("unknown dtype for ndarray" )
171172 elif isinstance (arg , np .generic ):
172173 data_ctypes = dtype_map [dtype_str ](arg )
173- numpy_arg = arg
174174 elif is_cupy_array (arg ):
175175 data_ctypes = C .c_void_p (arg .data .ptr )
176176 elif isinstance (arg , DeviceArray ):
177177 data_ctypes = arg .as_c_void_p ()
178- numpy_arg = None
179178
180179 ctype_args [i ] = Argument (numpy = arg , ctypes = data_ctypes )
181180 self .allocations .append (Argument (numpy = arg .copy (), ctypes = data_ctypes ))
@@ -283,7 +282,7 @@ def compile(self, kernel_instance):
283282 stdout = subprocess .PIPE ,
284283 stderr = subprocess .PIPE ,
285284 text = True ,
286- check = True
285+ check = True ,
287286 )
288287
289288 subprocess .run (
@@ -294,7 +293,7 @@ def compile(self, kernel_instance):
294293 stdout = subprocess .PIPE ,
295294 stderr = subprocess .PIPE ,
296295 text = True ,
297- check = True
296+ check = True ,
298297 )
299298
300299 self .lib = np .ctypeslib .load_library (filename , "." )
0 commit comments