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

Method test_plot_runs

test/analysis/test_analyzers.py:27–55  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

25 ta.writer.close()
26
27 def test_plot_runs(self):
28 ma = MatplotlibAnalyzer()
29 ta = TensorboardAnalyzer("./logs/runs")
30
31 for analyzer in [ma, ta]:
32 obs = torch.rand(1, 28, 28)
33 analyzer.plot_obs(obs)
34
35 # 4 channels out, 1 channel in, 8x8 kernels
36 conv_weights = torch.rand(4, 1, 8, 8)
37 analyzer.plot_conv2d_weights(conv_weights)
38
39 rewards = [0, 0, 0, 0, 0]
40 analyzer.plot_reward(rewards)
41
42 # Monitors have time as last dimension
43 v = torch.rand(50, 1, 1, 28, 28)
44 voltage_dict = {"X": v}
45 threshold_dict = {"X": torch.tensor(0.75)}
46 analyzer.plot_voltages(voltage_dict, threshold_dict)
47
48 # The monitors have time as last dimension
49 spikes = torch.rand(50, 1, 1, 28, 28) > 0.5
50 spike_dict = {"X": spikes}
51 analyzer.plot_spikes(spike_dict)
52
53 analyzer.finalize_step()
54
55 ta.writer.close()
56
57
58if __name__ == "__main__":

Callers 1

test_analyzers.pyFile · 0.80

Calls 9

MatplotlibAnalyzerClass · 0.90
TensorboardAnalyzerClass · 0.90
plot_obsMethod · 0.45
plot_conv2d_weightsMethod · 0.45
plot_rewardMethod · 0.45
plot_voltagesMethod · 0.45
plot_spikesMethod · 0.45
finalize_stepMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected