python tensorflow 2.0 convlstm等效

时间:2020-04-25 09:21:40

标签: python tensorflow keras

我正在尝试将下面的代码转换为TensorFlow 2.0中的tf.keras:

from tensorflow.contrib import rnn
lstm = BasicConvLSTMCell(shape, [3, 3], num_features=2, scope='lstm',
                                    activation=tf.nn.relu)
 _, state = rnn.static_rnn(lstm, output_list, initial_state=state, dtype=tf.float32)

上面的代码是否等同于仅使用tf.keras.layers.ConvLSTM2D层? (https://www.tensorflow.org/api_docs/python/tf/keras/layers/ConvLSTM2D

如果确实使用ConvLSTM2D层,是否应该将其包装在tf.keras.layers.RNN对象中?我对这样做与不这样做之间的区别感到困惑。谢谢

0 个答案:

没有答案