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

Function BindsNET_cpu

examples/benchmark/benchmark.py:35–54  ·  view source on GitHub ↗
(n_neurons, time)

Source from the content-addressed store, hash-verified

33
34
35def BindsNET_cpu(n_neurons, time):
36 t0 = t()
37
38 torch.set_default_tensor_type("torch.FloatTensor")
39
40 t1 = t()
41
42 network = Network()
43 network.add_layer(Input(n=n_neurons), name="X")
44 network.add_layer(LIFNodes(n=n_neurons), name="Y")
45 network.add_connection(
46 Connection(source=network.layers["X"], target=network.layers["Y"]),
47 source="X",
48 target="Y",
49 )
50
51 data = {"X": poisson(datum=torch.rand(n_neurons), time=time)}
52 network.run(inputs=data, time=time)
53
54 return t() - t0, t() - t1
55
56
57def BindsNET_gpu(n_neurons, time):

Callers

nothing calls this directly

Calls 8

add_layerMethod · 0.95
add_connectionMethod · 0.95
runMethod · 0.95
NetworkClass · 0.90
InputClass · 0.90
LIFNodesClass · 0.90
ConnectionClass · 0.90
poissonFunction · 0.90

Tested by

no test coverage detected