整理自:TensorFlow中RNN实现的正确打开方式:https://blog.youkuaiyun.com/starzhou/article/details/77848156
RNN的基本单元“RNNcell”
(output, next_state) = call(input, state)。
- 每调用一次RNNCell的call方法,就相当于在时间上“推进了一步”,这就是RNNCell的基本功能。
- 执行一次,序列时间上前进一步。
- 有两个子类:BasicRNNCell和BasicLSTMCell
cell = tf.nn.rnn_cell.BasicRNNCell(num_units=128)
print(cell.state_size) # 隐藏层的大小:128
inputs = tf.placeholder(np.float32,shape=(32,100)) # 32为batch_size
h0 = cell.zero_state(32