I want to train sequence data to Rnn base model with some zero paddings using tensorflow.
And I want model to ignore 0 values when training.
Do I have to set parameters to do that? or Does model automatically ignore zeros?
Thanks,,
I want to train sequence data to Rnn base model with some zero paddings using tensorflow.
And I want model to ignore 0 values when training.
Do I have to set parameters to do that? or Does model automatically ignore zeros?
Thanks,,
Copyright © 2021 Jogjafile Inc.
It is not automatic, You should introduce
Masking
to achieve this. It means how layers are able to know when to ignore certain timesteps in sequence inputs.You can introduce it in three ways
tf.keras.layers.Masking
layertf.keras.layers.Embedding
layer withmask_zero=True
mask
argument manually when calling layers that support this argumentFor more information you can refer Masking and padding with Keras guide.