(n_neurons, time)
| 55 | |
| 56 | |
| 57 | def 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 | |
| 80 | def BRIAN2(n_neurons, time): |
nothing calls this directly
no test coverage detected