Skip to content

Commit 96479e6

Browse files
Merge pull request #708 from BindsNET/hananel
Update to PyTorch 2.6.0
2 parents 01bc1b0 + 5891adf commit 96479e6

File tree

3 files changed

+470
-459
lines changed

3 files changed

+470
-459
lines changed

bindsnet/network/network.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ def load(file_name: str, map_location: str = "cpu", learning: bool = None) -> "N
1919
:param learning: Whether to load with learning enabled. Default loads value from
2020
disk.
2121
"""
22-
network = torch.load(open(file_name, "rb"), map_location=map_location)
22+
network = torch.load(
23+
open(file_name, "rb"), map_location=map_location, weights_only=False
24+
)
2325
if learning is not None and "learning" in vars(network):
2426
network.learning = learning
2527

@@ -191,6 +193,7 @@ def save(self, file_name: str) -> None:
191193
# Save the network to disk.
192194
network.save(str(Path.home()) + '/network.pt')
193195
"""
196+
torch.serialization.add_safe_globals([self])
194197
torch.save(self, open(file_name, "wb"))
195198

196199
def clone(self) -> "Network":

0 commit comments

Comments
 (0)