Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
da-liii opened this issue Apr 3, 2023 · 0 comments
Open

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

da-liii opened this issue Apr 3, 2023 · 0 comments

Comments

@da-liii
Copy link

da-liii commented Apr 3, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant