예제 #1
0
 def forward(self, X, mode):
     h = np.zeros(self.hshape)  # init hidden state
     for t in xrange(self.num_unroll_steps):
         h = layers.rnn_step(X, h, self.params['Wx'],
                             self.params['Wh'], self.params['b'])
     y = layers.affine(h, self.params['Wa'], self.params['ba'])
     return y
예제 #2
0
 def forward(self, X, mode):
     h = np.zeros(self.hshape)  # init hidden state
     for t in range(self.num_unroll_steps):
         h = layers.rnn_step(X, h, self.params['Wx'], self.params['Wh'],
                             self.params['b'])
     y = layers.affine(h, self.params['Wa'], self.params['ba'])
     return y
예제 #3
0
파일: rnn.py 프로젝트: HrWangChengdu/minpy
 def forward(self, X, mode):
     seq_len = X.shape[1]
     h = self.params['h0']
     for t in xrange(seq_len):
         h = layers.rnn_step(X[:, t, :], h, self.params['Wx'],
                             self.params['Wh'], self.params['b'])
     y = layers.affine(h, self.params['Wa'], self.params['ba'])
     return y
예제 #4
0
파일: rnn.py 프로젝트: sxjscience/minpy
 def forward(self, X, mode):
     seq_len = X.shape[1]
     h = self.params['h0']
     for t in xrange(seq_len):
         h = layers.rnn_step(X[:, t, :], h, self.params['Wx'],
                             self.params['Wh'], self.params['b'])
     y = layers.affine(h, self.params['Wa'], self.params['ba'])
     return y
예제 #5
0
파일: deparser.py 프로젝트: wddabc/minpy
 def step(self, x, h, *args, **kwargs):
     """
     Abstract step function for rnn
     :param x: current input, batched matrix
     :param h: previous output
     :return: output
     """
     return layers.rnn_step(x, h, self.params('Wx'), self.params('Wh'),
                            self.params('b'))
예제 #6
0
 def forward(self, X, mode):
     seq_len = X.shape[1]
     batch_size = X.shape[0]
     hidden_size = self.params['Wh'].shape[0]
     h = np.zeros((batch_size, hidden_size))
     for t in xrange(seq_len):
         h = layers.rnn_step(X[:, t, :], h, self.params['Wx'],
                             self.params['Wh'], self.params['b'])
     y = layers.affine(h, self.params['Wa'], self.params['ba'])
     return y