def __init__(self, n_visible, n_hidden, train_k=1, sample_k=1000, theano_rng=None, persistent=None, **kwargs): self.n_visible = n_visible self.n_hidden = n_hidden if theano_rng is None: theano_rng = RandomStreams(np.random.randint(2**30)) assert kwargs.has_key('weight') assert kwargs.has_key('hbias') assert kwargs.has_key('vbias') assert not kwargs['weight'].has_key('shape') assert not kwargs['vbias'].has_key('shape') assert not kwargs['hbias'].has_key('shape') self.W = init_shared(shape=(n_visible, n_hidden), **kwargs['weight']) self.hbias = init_shared(shape=(n_hidden, ), **kwargs['hbias']) self.vbias = init_shared(shape=(n_visible, ), **kwargs['vbias']) self.theano_rng = theano_rng self.persistent = persistent self.train_k = train_k self.sample_k = sample_k self.input = T.matrix()
def __init__(self, subSampleShape, **kwargs): layer.__init__(self) assert len(subSampleShape) == 2 self.subSampleShape = subSampleShape assert kwargs.has_key('coef') assert kwargs.has_key('bias') self.coef = init_shared(**kwargs['coef']) self.bias = init_shared(**kwargs['bias'])
def __init__(self, n_visible, n_hidden, train_k=1, sample_k=1000, theano_rng=None, persistent=None, **kwargs): self.n_visible = n_visible self.n_hidden = n_hidden if theano_rng is None: theano_rng = RandomStreams(np.random.randint(2**30)) assert kwargs.has_key('weight') assert kwargs.has_key('hbias') assert kwargs.has_key('vbias') assert not kwargs['weight'].has_key('shape') assert not kwargs['vbias'].has_key('shape') assert not kwargs['hbias'].has_key('shape') self.W = init_shared(shape=(n_visible, n_hidden), **kwargs['weight'] ) self.hbias = init_shared(shape=(n_hidden,), **kwargs['hbias'] ) self.vbias = init_shared(shape=(n_visible,), **kwargs['vbias'] ) self.theano_rng = theano_rng self.persistent = persistent self.train_k = train_k self.sample_k = sample_k self.input = T.matrix()
def init_bias(self): self.b = init_shared(shape=(self.numOfOutput, ), **self.biasKwargs)
def init_weights(self): self.W = init_shared(shape=self.get_weightShape(), **self.weightKwargs)
def init_kernels(self, numOfConnections): self.kernels = init_shared(shape=numOfConnections, **self.kernelKwargs)
def init_filters(self): self.filters = [] for i in xrange(self.get_numOfFilters()): self.filters.append( init_shared(shape=self.get_filterShape(), **self.filterKwargs))
def init_bias(self): self.bias = init_shared(**self.biasKwargs)
def init_filters(self, n_pre_fm): self.filterShape = (self.n_fm, n_pre_fm) + self.filterDs self.filters = init_shared(shape=self.get_filterShape(), **self.filterKwargs)
def init_bias(self): ''' :var n_fm means the number of this layer's feature maps ''' self.bias = init_shared(shape=(self.n_fm, ), **self.biasKwargs)
def init_bias(self): ''' :var n_fm means the number of this layer's feature maps ''' self.bias = init_shared(shape=(self.n_fm,), **self.biasKwargs)
def init_filters(self): self.filters = [] for i in xrange(self.get_numOfFilters()): self.filters.append( init_shared(shape=self.get_filterShape(), **self.filterKwargs) )