MCPcopy Create free account
hub / github.com/BindsNET/bindsnet / load

Function load

bindsnet/network/network.py:12–28  ·  view source on GitHub ↗

Loads serialized network object from disk. :param file_name: Path to serialized network object on disk. :param map_location: One of ``"cpu"`` or ``"cuda"``. Defaults to ``"cpu"``. :param learning: Whether to load with learning enabled. Default loads value from disk.

(file_name: str, map_location: str = "cpu", learning: bool = None)

Source from the content-addressed store, hash-verified

10
11
12def load(file_name: str, map_location: str = "cpu", learning: bool = None) -> "Network":
13 # language=rst
14 """
15 Loads serialized network object from disk.
16
17 :param file_name: Path to serialized network object on disk.
18 :param map_location: One of ``"cpu"`` or ``"cuda"``. Defaults to ``"cpu"``.
19 :param learning: Whether to load with learning enabled. Default loads value from
20 disk.
21 """
22 network = torch.load(
23 open(file_name, "rb"), map_location=map_location, weights_only=False
24 )
25 if learning is not None and "learning" in vars(network):
26 network.learning = learning
27
28 return network
29
30
31class Network(torch.nn.Module):

Callers 2

test_emptyMethod · 0.90
test_add_objectsMethod · 0.90

Calls

no outgoing calls

Tested by 2

test_emptyMethod · 0.72
test_add_objectsMethod · 0.72