This blog is for notes on how to use the Nengo spiking neuron modeling system

Friday, June 24, 2011

un convolve

To unconvolve something take the convolved vector and convolve it with the inverse of one of the vectors that got convolved. This will produce the vector that it was convolved with. Here is some code

import nef
import hrr
vocab=hrr.Vocabulary(128)
vocab.parse('cat,dog,mouse')

net=nef.Network('Test Network',quick=True)


A=net.make_array('A',neurons=8,dimensions=1,length=64)
B=net.make_array('B',neurons=8,dimensions=1,length=64)
C=net.make_array('C',neurons=8,dimensions=1,length=64)
D=net.make_array('D',neurons=8,dimensions=1,length=64)
E=net.make_array('E',neurons=8,dimensions=1,length=64)


# convolve A and B together into C - function only works on pairs
Conv1=nef.convolution.make_convolution(net,'conv1',A,B,C,N_per_D=200,quick=True,mode='direct') # direct tells it to do it without neurons
Conv2=nef.convolution.make_convolution(net,'conv2',C,D,E,N_per_D=200,quick=True,invert_second=True) # it saves power but produces no noise


net.add_to(world)

No comments:

Post a Comment