Suppose we have raw data like this:
raw_inputs = [
[711, 7, 632, 71],
[73, 8, 3215, 55, 927],
[83, 91, 1, 645, 1253, 927],
]
After padding:
padded_inputs = tf.keras.preprocessing.sequence.pad_sequences(
raw_inputs, padding="post")
The result is
[[ 711 7 632 71 0 0]
[ 73 8 3215 55 927 0]
[ 83 91 1 645 1253 927]]
If I use Masking layer for the above data, it is a correct mask. But if I use one-hot encoding first, and transform the above data into a three-dimensional tensor. There are some zeros which I don't want to mask. But the masking layer will treat the zero values equally. Can I create a mask array by myself instead of detecting zeros directly?
BTW: in keras, the padding element zero will not be a zero vector after one-hot encoding. How can I do? Should I care about that?