fix try-except block for attributes checking
@@ -73,14 +73,15 @@ class RecursiveAttr(FallbackUtil):
if self.name == 'numpy':
raise TypeError("'module' object is not callable")
- # trying cupy
try:
-
+ # trying cupy
cupy_func = super().get_func('cp', attributes)
return call_cupy(cupy_func, args, kwargs)
except AttributeError:
+
+ try:
# trying numpy
if super().notification_status():
@@ -91,15 +92,15 @@ class RecursiveAttr(FallbackUtil):
print("'{}' not found in cupy, falling back to numpy"
.format(func_name))
else:
- print("'{}.{}' not found in cupy, falling back to numpy"
- .format(sub_module, func_name))
+ print("'{}' not found in cupy, falling back to numpy"
+ .format(sub_module + '.' + func_name))
numpy_func = super().get_func('np', attributes)
return call_numpy(numpy_func, args, kwargs)
except AttributeError:
- raise AttributeError("Attribute {} neither in cupy nor numpy"
+ raise AttributeError("Attribute '{}' neither in cupy nor numpy"
.format(".".join(attributes)))
