Example #1
0
 def __init__(self,setup):
     N.checkDictKeys(setup,['dim','lr'],rerr=True)
     super(IafLayer, self).__init__(setup)
     self.dimin = self.dimout = self.dim
     self.b = N.sharedScalar(0.)
     self.x = T.fmatrix()
     # self.w = N.sharedf(npr.rand(self.dim))
     self.u = N.sharedf(npr.rand(self.dim))
     self.w = N.sharedf([0.]*self.dim)
Example #2
0
 def setParams(self, w, b, u):
     '''
     DON'T USE
     should replace the values of w,b,u in-place
     '''
     w,b,u = np.asarray(w), np.asarray(b), np.asarray(u)
     self.w = N.sharedf(w, name='w')
     self.b = N.sharedf(b, name='b')
     self.u = N.sharedf(u, name='u')
     self.params = [self.w, self.b, self.u]
Example #3
0
 def initWeight(self):
     self.w = N.sharedf(mathZ.permutMat(self.dim))
     self.detJ = N.sharedsfGpu(0.)
Example #4
0
 def setWeight(self,weights,bias=None):
     self.w = N.sharedf(np.asarray(weights))
     if bias is not None:
         self.bias = True
         self.b = N.sharedf(np.asarray(bias))
Example #5
0
 def initLogPrior(self):
     noisevar = N.sharedf(np.eye(self.dim))*T.sqr(self.priorstd)
     noisemu = N.sharedf(np.zeros(self.dim))
     self.logPrior = mathT.gaussInit(noisemu, noisevar)
Example #6
0
 def setWeight(self,weight):
     self.w = N.sharedf( np.asarray(weight) )
Example #7
0
 def __init__(self,name,dim):
     super(IafPermute,self).__init__(name)
     self.dimin = self.dimout = dim
     self.w = N.sharedf( mathZ.permutMat(self.dimin,enforcing=True) )