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

Method test_bernoulli_loader

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

Source from the content-addressed store, hash-verified

27 assert spikes.size() == torch.Size((t, *shape))
28
29 def test_bernoulli_loader(self):
30 for s in [1, 100]: # number of data samples
31 for n in [1, 100]: # number of nodes in layer
32 for m in [0.1, 1.0]: # maximum spiking probability
33 for t in [1, 100]: # number of timesteps
34 data = torch.empty(s, n).uniform_(0, 1)
35 spike_loader = bernoulli_loader(data, time=t, max_prob=m)
36
37 for i, spikes in enumerate(spike_loader):
38 assert spikes.size() == torch.Size((t, n))
39
40 def test_poisson(self):
41 for n in [1, 100]: # number of nodes in layer

Callers

nothing calls this directly

Calls 1

bernoulli_loaderFunction · 0.85

Tested by

no test coverage detected