Skip to content
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

在计算output pooling时不用mask吗? #6

Open
shaomai00 opened this issue Aug 10, 2021 · 1 comment
Open

在计算output pooling时不用mask吗? #6

shaomai00 opened this issue Aug 10, 2021 · 1 comment

Comments

@shaomai00
Copy link

shaomai00 commented Aug 10, 2021

if pooling == 'first-last-avg':
outputs = [
keras.layers.GlobalAveragePooling1D()(outputs[0]),
keras.layers.GlobalAveragePooling1D()(outputs[-1])
]
output = keras.layers.Average()(outputs)
elif pooling == 'last-avg':
output = keras.layers.GlobalAveragePooling1D()(outputs[-1])
elif pooling == 'cls':
output = keras.layers.Lambda(lambda x: x[:, 0])(outputs[-1])
elif pooling == 'pooler':
output = bert.output

平时不用keras, 但是查了一下GlobalAveragePooling1D是有mask入参的,这个不加attention_mask进来不是会有问题吗?
https://keras.io/api/layers/pooling_layers/global_average_pooling1d/

@bojone
Copy link
Owner

bojone commented Aug 11, 2021

自带有mask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants