You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In executing the create_checkerboard function and a couple others, you'd get an error like the one below rather than having the expected pattern returned. This is due to removal of a previously deprecated attribute .int from numpy. Replacing it with builtin int as suggested resolves the issue.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[1], line 11
9 factory = pattern_tools.PatternFactory(pattern_size, pattern_size)
10 # create a checkerboard pattern and add it to the pattern list
---> 11 checkerboard = factory.create_checkerboard()
12 pattern_list = [checkerboard]
14 # add random patterns to the list
File ~/work/neuronal-dynamics/bmnn/lib/python3.11/site-packages/neurodynex3/hopfield_network/pattern_tools.py:116, in PatternFactory.create_checkerboard(self)
110 def create_checkerboard(self):
111 """
112 creates a checkerboard pattern of size (pattern_length x pattern_width)
113 Returns:
114 checkerboard pattern
115 """
--> 116 pw = np.ones(self.pattern_length, np.int)
117 # set every second value to -1
118 pw[1::2] = -1
File ~/work/neuronal-dynamics/bmnn/lib/python3.11/site-packages/numpy/__init__.py:313, in __getattr__(attr)
308 warnings.warn(
309 f"In the future `np.{attr}` will be defined as the "
310 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
312 if attr in __former_attrs__:
--> 313 raise AttributeError(__former_attrs__[attr])
315 if attr == 'testing':
316 import numpy.testing as testing
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
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
The text was updated successfully, but these errors were encountered:
mwatts15
added a commit
to mwatts15/neuronaldynamics-exercises
that referenced
this issue
Jul 14, 2023
In executing the create_checkerboard function and a couple others, you'd get an error like the one below rather than having the expected pattern returned. This is due to removal of a previously deprecated attribute
.int
from numpy. Replacing it with builtinint
as suggested resolves the issue.The text was updated successfully, but these errors were encountered: