我正在尝试使用带有 TensorFlow 后端(1.2.1)的 Keras(2.0.6)从卷积 LSTM 层中屏蔽丢失的数据:
import keras
from keras.models import Sequential
from keras.layers import Masking, ConvLSTM2D
n_timesteps = 10
n_width = 64
n_height = 64
n_channels = 1
model = Sequential()
model.add(Masking(mask_value = 0., input_shape = (n_timesteps, n_width, n_height, n_channels)))
model.add(ConvLSTM2D(filters = 64, kernel_size = (3, 3)))
但是我收到以下ValueError:
ValueError: Shape must be rank 4 but is rank 2 for 'conv_lst_m2d_1/while/Tile' (op: 'Tile') with input shapes: [?,64,64,1], [2].
如何将 Masking 与 ConvLSTM2D 层一起使用?