def __init__(self, n_in, n_hidden, n_out, activation=T.tanh, inner_activation=T.nnet.sigmoid, output_type='real', batch_size=200): self.activation = activation self.inner_activation = inner_activation self.output_type = output_type self.batch_size = batch_size self.n_hidden = n_hidden self.W_i = shared_common(gloroat_uniform((n_in, n_hidden))) self.U_i = shared_common(ortho_weight(n_hidden)) self.b_i = shared_zeros((n_hidden, )) self.W_f = shared_common(gloroat_uniform((n_in, n_hidden))) self.U_f = shared_common(ortho_weight(n_hidden)) self.b_f = shared_zeros((n_hidden, )) self.W_c = shared_common(gloroat_uniform((n_in, n_hidden))) self.U_c = shared_common(ortho_weight(n_hidden)) self.b_c = shared_zeros((n_hidden, )) self.W_o = shared_common(gloroat_uniform((n_in, n_hidden))) self.U_o = shared_common(ortho_weight(n_hidden)) self.b_o = shared_zeros((n_hidden, )) self.params = [ self.W_i, self.U_i, self.b_i, self.W_c, self.U_c, self.b_c, self.W_f, self.U_f, self.b_f, self.W_o, self.U_o, self.b_o ]
def __init__(self, rng, n_in, n_out, tensor_num=3, activation=T.tanh): self.tensor_num = tensor_num self.W = [] for i in range(tensor_num): self.W.append(shared_common(ortho_weight(100))) self.activation = activation self.hidden_layer = HiddenLayer2(rng, tensor_num * 5 * n_in, n_out) self.params = self.W + self.hidden_layer.params
def __init__(self, rng, n_in, n_out, W=None, b=None, activation=T.tanh, hidden_size=100): self.W = shared_common(ortho_weight(hidden_size), 'W') self.activation = activation self.hidden_layer = HiddenLayer2(rng, 2 * 5 * n_in, n_out) self.params = [self.W] + self.hidden_layer.params
def __init__(self, rng, n_in, n_out, W=None, b=None, activation=T.tanh, hidden_size=100): self.W = shared_common(ortho_weight(hidden_size)) self.activation = activation self.conv_layer = LeNetConvPoolLayer(rng, filter_shape=(8, 1, 3, 3), image_shape=(200, 1, 50, 50), poolsize=(3, 3), non_linear='relu') self.hidden_layer = HiddenLayer2(rng, 2048, n_out) self.params = self.conv_layer.params + self.hidden_layer.params
def __init__(self, input_l, input_r, n_in, n_hidden, n_out, activation=T.tanh, output_type='real', batch_size=200, input_lm=None, input_rm=None): if input_lm is None: input_lm = shared_ones((batch_size, 20)) if input_rm is None: input_rm = shared_ones((batch_size, 20)) self.activation = activation self.output_type = output_type self.W = shared_common(ortho_weight(n_hidden), 'W') self.W_in = shared_common(gloroat_uniform(n_in, n_hidden), 'W_in') self.h0 = shared_zeros((batch_size, n_hidden), 'h0') self.bh = shared_zeros((batch_size, n_hidden), 'bh') self.params = [self.W, self.W_in, self.bh] def step(x_t, mask, h_tm1): h_tm1 = mask * h_tm1 h_t = T.tanh( T.dot(x_t, self.W_in) + T.dot(h_tm1, self.W) + self.bh) return h_t self.h_l, _ = scan_dimshuffle(step, input_l, input_lm, shared_zeros((batch_size, n_hidden))) self.h_r, _ = scan_dimshuffle(step, input_r, input_rm, shared_zeros((batch_size, n_hidden))) self.h_l = self.h_l.dimshuffle(1, 0, 2) self.h_r = self.h_r.dimshuffle(1, 0, 2)