Skip to content

Numpy does not support dtype "long" anymore in the latest version #50

@CaiTH0618

Description

@CaiTH0618

I am using method stat and it raises an ERROR: "AttributeError: module 'numpy' has no attribute 'long'. Did you mean: 'log'?".

My numpy version is 1.26.0

The error information is:

/home/cai/.local/lib/python3.10/site-packages/torchstat/model_hook.py:65: FutureWarning: In the future `np.long` will be defined as the corresponding NumPy scalar.
  np.array([parameter_quantity], dtype=np.long))
Traceback (most recent call last):
  File "/home/cai/ModelDemos/VGG/vgg19.py", line 18, in <module>
    stat(model, input_size)
  File "/home/cai/.local/lib/python3.10/site-packages/torchstat/statistics.py", line 71, in stat
    ms.show_report()
  File "/home/cai/.local/lib/python3.10/site-packages/torchstat/statistics.py", line 64, in show_report
    collected_nodes = self._analyze_model()
  File "/home/cai/.local/lib/python3.10/site-packages/torchstat/statistics.py", line 57, in _analyze_model
    model_hook = ModelHook(self._model, self._input_size)
  File "/home/cai/.local/lib/python3.10/site-packages/torchstat/model_hook.py", line 24, in __init__
    self._model(x)
  File "/home/cai/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/cai/.local/lib/python3.10/site-packages/torchvision/models/vgg.py", line 66, in forward
    x = self.features(x)
  File "/home/cai/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/cai/.local/lib/python3.10/site-packages/torch/nn/modules/container.py", line 217, in forward
    input = module(input)
  File "/home/cai/.local/lib/python3.10/site-packages/torchstat/model_hook.py", line 65, in wrap_call
    np.array([parameter_quantity], dtype=np.long))
  File "/home/cai/.local/lib/python3.10/site-packages/numpy/__init__.py", line 333, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'long'. Did you mean: 'log'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions