def param_init_fflayer(options, params, prefix='ff', nin=None, nout=None, ortho=True): """ Affine transformation + point-wise nonlinearity """ if nin == None: nin = options['dim_proj'] if nout == None: nout = options['dim_proj'] params[_p(prefix,'W')] = xavier_weight(nin, nout) params[_p(prefix,'b')] = numpy.zeros((nout,)).astype('float32') return params
def param_init_fclayer(options, params, prefix='fc', nin=None, nout=None, ortho=True): """ Affine transformation + point-wise nonlinearity """ if nin == None: nin = options['dim_proj'] if nout == None: nout = options['nCategories'] params[prefix+'_w'] = theano.shared(value=xavier_weight(nin, nout), borrow=True) params[prefix+'_b'] = theano.shared(value=np.zeros((nout,)).astype('float32'), borrow=True) return params
def init_weights(self): xavier_weight(self.linear1.weight) self.linear1.bias.data.fill_(0) xavier_weight(self.linear2.weight) self.linear1.bias.data.fill_(0) xavier_weight(self.linear3.weight) self.linear1.bias.data.fill_(0)
def param_init_fflayer(options, params, prefix='ff', nin=None, nout=None, ortho=True): """ Affine transformation + point-wise nonlinearity """ if nin == None: nin = options['dim_proj'] if nout == None: nout = options['dim_proj'] params[_p(prefix, 'W')] = xavier_weight(nin, nout) params[_p(prefix, 'b')] = numpy.zeros((nout, )).astype('float32') return params
def init_weights(self): xavier_weight(self.linear.weight) # init.xavier_normal(self.linear.weight) self.linear.bias.data.fill_(0)
def init_weights(self): xavier_weight(self.decoderini.weight) self.decoderini.bias.data.fill_(0)