From 67744744e142c8a9044e4967c8871431d6d4f4dd Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 7 May 2020 06:37:14 +0000 Subject: [PATCH 1/2] fix the error message of reshape() --- python/mxnet/numpy/multiarray.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mxnet/numpy/multiarray.py b/python/mxnet/numpy/multiarray.py index f8cf69aaa1c4..be34554dae93 100644 --- a/python/mxnet/numpy/multiarray.py +++ b/python/mxnet/numpy/multiarray.py @@ -1436,7 +1436,7 @@ def reshape(self, *args, **kwargs): # pylint: disable=arguments-differ if len(kwargs) == 1: if 'order' not in kwargs: raise TypeError('{} is an invalid keyword argument for this function' - .format(kwargs.keys()[0])) + .format(list(kwargs.keys())[0])) # python3.6 - TypeError: 'dict_keys' object does not support indexing order = kwargs.pop('order', 'C') if order != 'C': raise NotImplementedError('only supports C-order,' From 29ddefecb6246357d1f5eedcbba6282cf781a493 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 7 May 2020 10:31:12 +0000 Subject: [PATCH 2/2] Fixing issue #16655 reshape() error message --- python/mxnet/numpy/multiarray.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/mxnet/numpy/multiarray.py b/python/mxnet/numpy/multiarray.py index be34554dae93..6eb474ee2a64 100644 --- a/python/mxnet/numpy/multiarray.py +++ b/python/mxnet/numpy/multiarray.py @@ -1435,8 +1435,8 @@ def reshape(self, *args, **kwargs): # pylint: disable=arguments-differ raise TypeError('function takes at most 1 keyword argument') if len(kwargs) == 1: if 'order' not in kwargs: - raise TypeError('{} is an invalid keyword argument for this function' - .format(list(kwargs.keys())[0])) # python3.6 - TypeError: 'dict_keys' object does not support indexing + raise TypeError("'{}' is an invalid keyword argument for this function" + .format(list(kwargs.keys())[0])) order = kwargs.pop('order', 'C') if order != 'C': raise NotImplementedError('only supports C-order,'