From 2c31a1c017f5a390a941b00e1d941329b13d4231 Mon Sep 17 00:00:00 2001 From: cassiniXu Date: Tue, 21 Jan 2020 20:40:46 +0800 Subject: [PATCH] pylint error fix --- python/mxnet/ndarray/numpy/_op.py | 30 ++++++++++++---------------- python/mxnet/numpy/multiarray.py | 2 +- python/mxnet/symbol/numpy/_symbol.py | 4 +--- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/python/mxnet/ndarray/numpy/_op.py b/python/mxnet/ndarray/numpy/_op.py index ffca9a56949c..7c95d050657a 100644 --- a/python/mxnet/ndarray/numpy/_op.py +++ b/python/mxnet/ndarray/numpy/_op.py @@ -6577,21 +6577,17 @@ def pad(array, pad_width=None, mode="constant", reflect_type="even", constant_va if not isinstance(array, NDArray): raise TypeError("Input data should be NDarray") + if mode == "constant": + return _npi.pad(array, pad_width, 1, reflect_type, constant_values) + elif mode == "symmetric" and reflect_type == "even": + return _npi.pad(array, pad_width, 2, "even", constant_values) + elif mode == "edge": + return _npi.pad(array, pad_width, 3, reflect_type, constant_values) + elif mode == "reflect" and reflect_type == "even": + return _npi.pad(array, pad_width, 4, "even", constant_values) + elif mode == "maximum": + return _npi.pad(array, pad_width, 5, "even", constant_values) + elif mode == "minimum": + return _npi.pad(array, pad_width, 6, "even", constant_values) else: - if mode == "constant": - return _npi.pad(array, pad_width, 1, reflect_type, constant_values) - elif mode == "symmetric" and reflect_type == "even": - return _npi.pad(array, pad_width, 2, "even", constant_values) - elif mode == "edge": - return _npi.pad(array, pad_width, 3, reflect_type, constant_values) - elif mode == "reflect" and reflect_type == "even": - return _npi.pad(array, pad_width, 4, "even", constant_values) - elif mode == "empty": - pass - elif mode == "maximum": - return _npi.pad(array, pad_width, 5, "even", constant_values) - elif mode == "minimum": - return _npi.pad(array, pad_width, 6, "even", constant_values) - else: - raise ValueError("didn't support these modes and reflect_types.") - + raise ValueError("didn't support these modes and reflect_types.") diff --git a/python/mxnet/numpy/multiarray.py b/python/mxnet/numpy/multiarray.py index 67670d5d72d5..991c17d1eef6 100644 --- a/python/mxnet/numpy/multiarray.py +++ b/python/mxnet/numpy/multiarray.py @@ -8609,7 +8609,7 @@ def pad(x, pad_width=None, mode="constant", constant_values=0, reflect_type="eve pad : ndarray Padded array of rank equal to `array` with shape increased according to `pad_width`. - + Examples -------- >>> a = [1, 2, 3, 4, 5] diff --git a/python/mxnet/symbol/numpy/_symbol.py b/python/mxnet/symbol/numpy/_symbol.py index 51a1d8aeada2..75271b701b74 100644 --- a/python/mxnet/symbol/numpy/_symbol.py +++ b/python/mxnet/symbol/numpy/_symbol.py @@ -5923,7 +5923,7 @@ def pad(array, pad_width=None, mode="constant", reflect_type="even", constant_va end_values : not supported yet reflect_type : {'even', 'odd'}, optional only support even now - + Returns ------- pad : ndarray @@ -5938,8 +5938,6 @@ def pad(array, pad_width=None, mode="constant", reflect_type="even", constant_va return _npi.pad(array, pad_width, 3, reflect_type, constant_values) elif mode == "reflect" and reflect_type == "even": return _npi.pad(array, pad_width, 4, "even", constant_values) - elif mode == "empty": - pass elif mode == "maximum": return _npi.pad(array, pad_width, 5, "even", constant_values) elif mode == "minimum":