Keras model looks like this
inp = Input(shape=(maxlen, )) x = Embedding(max_features, embed_size, weights=[embedding_matrix], trainable=False)(inp) x = SpatialDropout1D(dropout)(x) x = Bidirectional(LSTM(num_filters, return_sequences=True))(x) max_pool = GlobalMaxPooling1D()(x) x = concatenate([x_h, max_pool]) outp = Dense(6, activation="sigmoid")(x)
According to the documentation the output shape = input shape i.e. (samples, timesteps, channels)
- What does SpatialDropout1D() really do to the output of Embedding()? I know the output of LSTM Embedding is of dimension (batch_size, steps, features).
- Does SpatialDropout1D() just randomly replace some values of word embedding of each word by 0?
- How is SpatialDropout1D() different from Dropout() in Keras?