Esempio n. 1
0
 def __init__(self,
              name,
              x,
              attn1,
              attn2,
              mask,
              x_in,
              attn1_in,
              attn2_in,
              n_out,
              path=None,
              init_func=normal_weight):
     SuperLayer.__init__(self, name, path)
     if path is None:
         self.params['Wx'] = to_shared(init_func((x_in, n_out)),
                                       self.name + '_Wx')
         self.params['Wv'] = to_shared(init_func((n_out, )),
                                       self.name + '_Wv')
         self.params['Wa_1'] = to_shared(init_func((attn1_in, n_out)),
                                         self.name + '_Wa_1')
         self.params['Wa_2'] = to_shared(init_func((attn2_in, n_out)),
                                         self.name + '_Wa_2')
         self.params['b'] = to_shared(init_bias((n_out, )),
                                      self.name + '_b')
     self.output = self.stream(x, attn1, attn2, mask)
Esempio n. 2
0
 def __init__(self, name, x, n_in, n_out, path=None, activation=T.tanh, init_func=normal_weight):
     SuperLayer.__init__(self, name, path)
     self.activation = activation
     if path is None:
         self.params['W'] = to_shared(init_func((n_in, n_out)), self.name + '_W')
         self.params['b'] = to_shared(init_bias((n_out,)), self.name + '_b')
     self.output = self.stream(x)
Esempio n. 3
0
 def __init__(self,
              name,
              x,
              n_voc,
              ndim,
              init_value=None,
              path=None,
              init_func=normal_weight):
     SuperLayer.__init__(self, name, path)
     if path is None:
         if init_value == None:
             self.params['E'] = to_shared(init_func((n_voc, ndim)),
                                          self.name + '_E')
         else:
             self.params['E'] = to_shared(init_value, self.name + '_E')
     self.output = self.stream(x)
Esempio n. 4
0
    def __init__(self,
                 name,
                 image,
                 filter_shape,
                 image_shape,
                 path=None,
                 init_func=normal_weight):
        SuperLayer.__init__(self, name, path)

        self.filter_shape = filter_shape
        self.image_shape = image_shape

        if path is None:
            self.params['W'] = to_shared(init_func(filter_shape),
                                         self.name + '_W')
            self.params['b'] = to_shared(init_bias((filter_shape[0], )),
                                         self.name + '_b')

        self.output = self.stream(image)
Esempio n. 5
0
    def __init__(self,
                 name,
                 x,
                 mask,
                 n_in,
                 hidden_size,
                 n_out,
                 path=None,
                 init_func=normal_weight):
        SuperLayer.__init__(self, name, path)
        if path is None:
            self.params['Wi'] = to_shared(init_func((n_in, hidden_size)),
                                          self.name + '_Wi')
            self.params['Wf'] = to_shared(init_func((n_in, hidden_size)),
                                          self.name + '_Wf')
            self.params['Wo'] = to_shared(init_func((n_in, hidden_size)),
                                          self.name + '_Wo')
            self.params['Wc'] = to_shared(init_func((n_in, hidden_size)),
                                          self.name + '_Wc')

            self.params['Ui'] = to_shared(
                init_func((hidden_size, hidden_size)), self.name + '_Ui')
            self.params['Uf'] = to_shared(
                init_func((hidden_size, hidden_size)), self.name + '_Uf')
            self.params['Uo'] = to_shared(
                init_func((hidden_size, hidden_size)), self.name + '_Uo')
            self.params['Uc'] = to_shared(
                init_func((hidden_size, hidden_size)), self.name + '_Uc')

            self.params['bi'] = to_shared(init_bias((n_out, )),
                                          self.name + '_bi')
            self.params['bf'] = to_shared(init_bias((n_out, )),
                                          self.name + '_bf')
            self.params['bo'] = to_shared(init_bias((n_out, )),
                                          self.name + '_bo')
            self.params['bc'] = to_shared(init_bias((n_out, )),
                                          self.name + '_bc')
        self.output = self.stream(x, mask)
Esempio n. 6
0
 def __init__(self, name, x, rate, is_train, path=None):
     SuperLayer.__init__(self, name, None)
     self.output = self.stream(x, rate, is_train)
Esempio n. 7
0
 def __init__(self, name, x, pooling_size, path=None):
     SuperLayer.__init__(self, name, path)
     self.pooling_size = pooling_size
     self.output = self.stream(x)