在keras构建深度学习模型时,在循环层中存在LSTMcell和LSTM两个API。该如何区分呢?
1 首先看源码
LSTMcell的源码:
class LSTMCell(Layer):
def __init__(self):
*****pass*****
def build(self, input_shape):
*****pass*****
self.built = True
def call(self, inputs, states, training=None):
*****pass*****
h_tm1 = states[0] # previous memory state
c_tm1 = states[1] # previous carry state