예제 #1
0
    def __init__(self,
                 hidden_dim,
                 activation='tanh',
                 inner_init='orthogonal',
                 parameters=None,
                 return_sequences=True):
        self.return_sequences = return_sequences
        self.hidden_dim = hidden_dim
        self.inner_init = get_initializer(inner_init)
        self.activation = get_activation(activation)
        self.activation_d = elementwise_grad(self.activation)
        self.sigmoid_d = elementwise_grad(sigmoid)

        if parameters is None:
            self._params = Parameters()
        else:
            self._params = parameters

        self.last_input = None
        self.states = None
        self.outputs = None
        self.gates = None
        self.hprev = None
        self.input_dim = None
        self.W = None
        self.U = None
예제 #2
0
 def __init__(self, hidden_dim, activation='tanh', inner_init='orthogonal', parameters=None, return_sequences=True):
     self.return_sequences = return_sequences
     self.hidden_dim = hidden_dim
     self.inner_init = get_initializer(inner_init)
     self.activation = get_activation(activation)
     self.activation_d = elementwise_grad(self.activation)
     if parameters is None:
         self._params = Parameters()
     else:
         self._params = parameters
     self.last_input = None
     self.states = None
     self.hprev = None
     self.input_dim = None