In [6]:
%load_ext autoreload
%autoreload 2
In [51]:
from nupic.research.frameworks.dynamic_sparse.networks import GSCHeb
from nupic.research.frameworks.dynamic_sparse.models import DSNNWeightedMag
import torch
In [20]:
network = GSCHeb()
In [25]:
network.features(torch.randn(1, 1,32,32)).shape
Out[25]:
In [38]:
network.classifier
Out[38]:
In [ ]:
network
In [39]:
x = torch.randn(4, 1600)
x = network.classifier[0](x)
x = network.classifier[1](x)
x = network.classifier[2](x)
x = network.classifier[3](x)
x.shape
Out[39]:
In [40]:
network.classifier(torch.randn(4, 1600)).shape
Out[40]:
In [43]:
network(torch.randn(4, 1,32,32)).shape
Out[43]:
In [44]:
network.init_hebbian()
In [46]:
network(torch.randn(4, 1,32,32)).shape
Out[46]:
In [47]:
for i in range(500):
network(torch.randn(16, 1,32,32))
In [48]:
network.coactivations
Out[48]:
In [59]:
network = GSCHeb()
model = DSNNWeightedMag(network, dict(on_perc=01.))
model.setup()
In [60]:
for i in range(4):
network(torch.randn(16, 1,32,32))
In [61]:
network.coactivations
Out[61]:
In [64]:
model._reinitialize_weights()
In [66]:
network.coactivations
Out[66]:
In [ ]: