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

Method test_mstdpet

test/network/test_learning.py:207–249  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

205 )
206
207 def test_mstdpet(self):
208 # Connection test
209 network = Network(dt=1.0)
210 network.add_layer(Input(n=100), name="input")
211 network.add_layer(LIFNodes(n=100), name="output")
212 network.add_connection(
213 Connection(
214 source=network.layers["input"],
215 target=network.layers["output"],
216 nu=1e-2,
217 update_rule=MSTDPET,
218 ),
219 source="input",
220 target="output",
221 )
222 network.run(
223 inputs={"input": torch.bernoulli(torch.rand(250, 100)).byte()},
224 time=250,
225 reward=1.0,
226 )
227
228 # Conv2dConnection test
229 network = Network(dt=1.0)
230 network.add_layer(Input(shape=[1, 10, 10]), name="input")
231 network.add_layer(LIFNodes(shape=[32, 8, 8]), name="output")
232 network.add_connection(
233 Conv2dConnection(
234 source=network.layers["input"],
235 target=network.layers["output"],
236 kernel_size=3,
237 stride=1,
238 nu=1e-2,
239 update_rule=MSTDPET,
240 ),
241 source="input",
242 target="output",
243 )
244
245 network.run(
246 inputs={"input": torch.bernoulli(torch.rand(250, 1, 1, 10, 10)).byte()},
247 time=250,
248 reward=1.0,
249 )
250
251 def test_rmax(self):
252 # Connection test

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
Conv2dConnectionClass · 0.90

Tested by

no test coverage detected