示例

1
2
3
4
5
6
7
8
9
import tensorflow.contrib.rnn as tcr

# 基本的Cell单元:num_units个
cell = tcr.BasicRNNCell(num_units=10)

# 将num_units个基本的Cell单元串联起来,输出是所以单元的输出和最终的状态
# outputs的形状是:[batch_size, max_time, cell_state_size]
# states的形状是:[batch_size, cell_state_size]
outputs, states = tcr.static_rnn(cell=cell, inputs=x, dtype=tf.float32)