| 69 | self.l_in_y = tf.reshape(l_in_y, [-1, self.n_steps, self.cell_size], name='2_3D') |
| 70 | |
| 71 | def add_cell(self): |
| 72 | lstm_cell = tf.contrib.rnn.BasicLSTMCell(self.cell_size, forget_bias=1.0, state_is_tuple=True) |
| 73 | with tf.name_scope('initial_state'): |
| 74 | self.cell_init_state = lstm_cell.zero_state(self.batch_size, dtype=tf.float32) |
| 75 | self.cell_outputs, self.cell_final_state = tf.nn.dynamic_rnn( |
| 76 | lstm_cell, self.l_in_y, initial_state=self.cell_init_state, time_major=False) |
| 77 | |
| 78 | def add_output_layer(self): |
| 79 | # shape = (batch * steps, cell_size) |