-
Notifications
You must be signed in to change notification settings - Fork 19.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About mask layer #20440
Comments
Hi @xiaohua6689 - Thanks for reporting the issue. Here you are getting
Attached gist for the reference. |
Using Rashape layer encountered new Error " UserWarning: Layer 'reshape' (of type Reshape) was passed an input with a mask attached to it. However, this layer does not support masking and will therefore destroy the mask information. Downstream layers will not see the mask."
|
Hi @xiaohua6689 - Here you can use separate keras.layers.Masking layer along with embedding layer. Embedding layer represent the integer into dense vectors and masking is used to handle variable length sequences.
Attached gist for the reference. |
model
a = Input(shape=[5])
b = Input(shape=[10])
emb_a = Embedding(8, 5, mask_zero=True)(a)
emb_b = Embedding(20, 5, mask_zero=True)(b)
cat = Concatenate(axis=1)([emb_a, emb_b])
lstm = LSTM(16)(cat)
dense = Dense(1)(lstm)
model = Model(inputs=[a, b], outputs=[dense])
##data
seed_value = 33
np.random.seed(seed_value)
tf.random.set_seed(seed_value)
input_a = np.random.randint(0, 8, size=(1, 5)) # [0, 7]
input_b = np.random.randint(0, 20, size=(1, 10)) # [0, 19]
Error information
ValueError: Exception encountered when calling BroadcastTo.call().
Attempt to convert a value (None) with an unsupported type (<class 'NoneType'>) to a Tensor.
Arguments received by BroadcastTo.call():
• x=tf.Tensor(shape=(1, 5, 1), dtype=bool)
The text was updated successfully, but these errors were encountered: