ndarray support kwargs
@@ -22,7 +22,7 @@ class ndarray:
def __getattr__(self, attr):
self.func = getattr(cp.ndarray, attr, None)
- if not callable(self.func):
+ if not callable(self.func) and self.func is not None:
return getattr(self._array, attr)
if self.func is not None:
@@ -31,18 +31,18 @@ class ndarray:
self.func = getattr(np.ndarray, attr)
return self._call_numpy_ndarray
- def _call_cupy_ndarray(self, *args):
+ def _call_cupy_ndarray(self, *args, **kwargs):
- res = self.func(self._array, *args)
+ res = self.func(self._array, *args, **kwargs)
return utils._get_fallback_ndarray(res)
- def _call_numpy_ndarray(self, *args):
+ def _call_numpy_ndarray(self, *args, **kwargs):
- numpy_args, _ = data_transfer._get_numpy_args(args, {})
+ numpy_args, numpy_kwargs = data_transfer._get_numpy_args(args, kwargs)
numpy_array = cp.asnumpy(self._array)
- numpy_res = self.func(numpy_array, *numpy_args)
+ numpy_res = self.func(numpy_array, *numpy_args, **numpy_kwargs)
cupy_res = data_transfer._get_cupy_result(numpy_res)
