Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bindsnet/network/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def load(file_name: str, map_location: str = "cpu", learning: bool = None) -> "N
:param learning: Whether to load with learning enabled. Default loads value from
disk.
"""
network = torch.load(open(file_name, "rb"), map_location=map_location)
network = torch.load(
open(file_name, "rb"), map_location=map_location, weights_only=False
)
if learning is not None and "learning" in vars(network):
network.learning = learning

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

def clone(self) -> "Network":
Expand Down
Loading