Modify _RecursiveAttr.__repr__
@@ -83,22 +83,13 @@ class _RecursiveAttr:
def __repr__(self):
- if self._cupy_object is not None:
- if isinstance(self._cupy_object, types.ModuleType):
- return "<module {} from cupy>".format(
- self._cupy_object.__name__)
-
- return "{} from {}".format(self._cupy_object.__repr__(),
- self._cupy_object.__module__)
-
- if self._numpy_object is not None:
if isinstance(self._numpy_object, types.ModuleType):
- return "<module {} from numpy>".format(
- self._numpy_object.__name__)
+ return ("<numpy = module {}, cupy = module {}>"
+ .format(self._numpy_object.__name__,
+ getattr(self._cupy_object, '__name__', None)))
- return "{} from {}".format(self._numpy_object.__repr__(),
- self._numpy_object.__module__)
- return "Attribute neither in cupy nor numpy"
+ return ("<numpy = {}, cupy = {}>"
+ .format(self._numpy_object, self._cupy_object))
def __call__(self, *args, **kwargs):
"""
