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

Function BindsNET_gpu

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

Source from the content-addressed store, hash-verified

55
56
57def BindsNET_gpu(n_neurons, time):
58 if torch.cuda.is_available():
59 t0 = t()
60
61 torch.set_default_tensor_type("torch.cuda.FloatTensor")
62
63 t1 = t()
64
65 network = Network()
66 network.add_layer(Input(n=n_neurons), name="X")
67 network.add_layer(LIFNodes(n=n_neurons), name="Y")
68 network.add_connection(
69 Connection(source=network.layers["X"], target=network.layers["Y"]),
70 source="X",
71 target="Y",
72 )
73
74 data = {"X": poisson(datum=torch.rand(n_neurons), time=time)}
75 network.run(inputs=data, time=time)
76
77 return t() - t0, t() - t1
78
79
80def BRIAN2(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