From 149ea0cd307c19617f94acac12b0424f9ee2d395 Mon Sep 17 00:00:00 2001 From: Michael W Date: Wed, 11 Oct 2023 13:32:08 -0700 Subject: [PATCH] utils.py - bool = bool importing mxnet with numpy 1.20+ results in > AttributeError: module 'numpy' has no attribute 'bool'. `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations `np.bool` was a deprecated alias for the builtin `bool`, so replace `np.bool` with `bool` --- python/mxnet/numpy/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mxnet/numpy/utils.py b/python/mxnet/numpy/utils.py index 21fe1e299d2e..5691b7feaec1 100644 --- a/python/mxnet/numpy/utils.py +++ b/python/mxnet/numpy/utils.py @@ -38,7 +38,7 @@ int8 = onp.dtype(onp.int8) int64 = onp.dtype(onp.int64) bool_ = onp.dtype(onp.bool_) -bool = onp.dtype(onp.bool) +bool = bool int16 = onp.dtype(onp.int16) uint16 = onp.dtype(onp.uint16) uint32 = onp.dtype(onp.uint32)