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

Method test_bernoulli

test/encoding/test_encoding.py:11–18  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

9 """
10
11 def test_bernoulli(self):
12 for n in [1, 100]: # number of nodes in layer
13 for t in [1, 100]: # number of timesteps
14 for m in [0.1, 1.0]: # maximum spiking probability
15 datum = torch.empty(n).uniform_(0, m)
16 spikes = bernoulli(datum, time=t, max_prob=m)
17
18 assert spikes.size() == torch.Size((t, n))
19
20 def test_multidim_bernoulli(self):
21 for shape in [[5, 5], [10, 10], [25, 25]]: # shape of nodes in layer

Callers

nothing calls this directly

Calls 1

bernoulliFunction · 0.85

Tested by

no test coverage detected