vision icon indicating copy to clipboard operation
vision copied to clipboard

AttributeError: module 'numpy' has no attribute 'bool'.

Open da-liii opened this issue 2 years ago • 0 comments

File ~/.cache/pants/named_caches/pex_root/venvs/s/526a591d/venv/lib/python3.8/site-packages/oneflow/framework/dtype.py:48
     43 def convert_proto_dtype_to_oneflow_dtype(proto_dtype):
     44     return oneflow._oneflow_internal.deprecated.GetDTypeByDataType(proto_dtype)
     47 _ONEFLOW_DTYPE_TO_NUMPY_DTYPE = {
---> 48     oneflow.bool: np.bool,
     49     oneflow.float: np.float32,
     50     oneflow.float16: np.float16,
     51     oneflow.float32: np.float32,
     52     oneflow.float64: np.double,
     53     oneflow.double: np.double,
     54     oneflow.int8: np.int8,
     55     oneflow.int32: np.int32,
     56     oneflow.int64: np.int64,
     57     oneflow.uint8: np.uint8,
     58 }
     61 def convert_oneflow_dtype_to_numpy_dtype(oneflow_dtype: oneflow.dtype):
     62     if oneflow_dtype not in _ONEFLOW_DTYPE_TO_NUMPY_DTYPE:

File ~/.cache/pants/named_caches/pex_root/venvs/s/526a591d/venv/lib/python3.8/site-packages/numpy/__init__.py:305, in __getattr__(attr)
    300     warnings.warn(
    301         f"In the future `np.{attr}` will be defined as the "
    302         "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    304 if attr in __former_attrs__:
--> 305     raise AttributeError(__former_attrs__[attr])
    307 # Importing Tester requires importing all of UnitTest which is not a
    308 # cheap import Since it is mainly used in test suits, we lazy import it
    309 # here to save on the order of 10 ms of import time for most users
    310 #
    311 # The previous way Tester was imported also had a side effect of adding
    312 # the full `numpy.testing` namespace
    313 if attr == 'testing':

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

相关依赖清单:

  • numpy==1.24.2
  • flowvision==0.2.1
  • oneflow==0.8.0

da-liii avatar Apr 03 '23 15:04 da-liii