From b353e4dc66381b435fb36d386607033a4d488a5d Mon Sep 17 00:00:00 2001 From: Abdullah Selek Date: Mon, 21 Aug 2023 18:20:56 +0300 Subject: [PATCH] Remove type `onp.bool`. - `np.bool` was a deprecated alias for the builtin `bool` with version 1.20. --- python/mxnet/numpy/utils.py | 3 +-- tests/python/unittest/test_numpy_op.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/python/mxnet/numpy/utils.py b/python/mxnet/numpy/utils.py index 21fe1e299d2e..ad74e2480a66 100644 --- a/python/mxnet/numpy/utils.py +++ b/python/mxnet/numpy/utils.py @@ -23,7 +23,7 @@ __all__ = ['float16', 'float32', 'float64', 'uint8', 'int32', 'int8', 'int64', 'int16', 'uint16', 'uint32', 'uint64', - 'bool', 'bool_', 'pi', 'inf', 'nan', 'PZERO', 'NZERO', 'newaxis', + 'bool_', 'pi', 'inf', 'nan', 'PZERO', 'NZERO', 'newaxis', 'e', 'NINF', 'PINF', 'NAN', 'NaN', '_STR_2_DTYPE_', '_DTYPE_2_STR_', '_type_promotion_table', 'integer_dtypes', 'floating_dtypes', 'boolean_dtypes', 'numeric_dtypes'] @@ -38,7 +38,6 @@ int8 = onp.dtype(onp.int8) int64 = onp.dtype(onp.int64) bool_ = onp.dtype(onp.bool_) -bool = onp.dtype(onp.bool) int16 = onp.dtype(onp.int16) uint16 = onp.dtype(onp.uint16) uint32 = onp.dtype(onp.uint32) diff --git a/tests/python/unittest/test_numpy_op.py b/tests/python/unittest/test_numpy_op.py index 1fcef46660d6..f97d2428a897 100644 --- a/tests/python/unittest/test_numpy_op.py +++ b/tests/python/unittest/test_numpy_op.py @@ -2094,7 +2094,7 @@ def forward(self, a, mask, value): if test_data.size == 0: break valid_num = int(mx_mask.asnumpy().sum()) - np_mask = mx_mask.asnumpy().astype(onp.bool) + np_mask = mx_mask.asnumpy().astype(onp.bool_) vshape = [] vshape_broadcast = [] for i in range(len(dshape)): @@ -5587,7 +5587,7 @@ def forward(self, a): for shape in shapes: for axis in [None] + [i for i in range(0, len(shape))]: for otype in [None, onp.int32, onp.int64]: - for itype in [onp.bool, onp.int8, onp.int32, onp.int64]: + for itype in [onp.bool_, onp.int8, onp.int32, onp.int64]: x = rand_ndarray(shape).astype(itype).as_np_ndarray() np_out = onp.cumsum(x.asnumpy(), axis=axis, dtype=otype) mx_out = np.cumsum(x, axis=axis, dtype=otype)