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

Monday, June 20, 2011

multipy and transpose

 Here is the multiplication example where the result is transposed into two different values

import nef
net=nef.Network('Test Network')
net.add_to(world)
input1=net.make_input('input1',values=[0])
input2=net.make_input('input2',values=[0])
A=net.make('A',neurons=100,dimensions=1)
B=net.make('B',neurons=100,dimensions=1)
C=net.make('C',neurons=100,dimensions=2)
D=net.make('D',neurons=100,dimensions=2)


net.connect(input1,A)
net.connect(input2,B)
net.connect(A,C,transform=[[1],[0]])
net.connect(B,C,transform=[[0],[1]],pstc=0.03) # can also set pstc here


def multiply(x):
  return x[0]*x[1]

net.connect(C,D,func=multiply,transform=[[.5],[1]])

No comments:

Post a Comment