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

Correct minor issue in the guide "Understanding masking & padding" #1904

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions guides/ipynb/understanding_masking_and_padding.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@
" broadcast_float_mask = tf.expand_dims(tf.cast(mask, \"float32\"), -1)\n",
" inputs_exp = tf.exp(inputs) * broadcast_float_mask\n",
" inputs_sum = tf.reduce_sum(\n",
" inputs_exp * broadcast_float_mask, axis=-1, keepdims=True\n",
" inputs_exp * broadcast_float_mask, axis=1, keepdims=True\n",
" )\n",
" return inputs_exp / inputs_sum\n",
"\n",
Expand Down Expand Up @@ -594,4 +594,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
2 changes: 1 addition & 1 deletion guides/md/understanding_masking_and_padding.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class TemporalSoftmax(keras.layers.Layer):
broadcast_float_mask = tf.expand_dims(tf.cast(mask, "float32"), -1)
inputs_exp = tf.exp(inputs) * broadcast_float_mask
inputs_sum = tf.reduce_sum(
inputs_exp * broadcast_float_mask, axis=-1, keepdims=True
inputs_exp * broadcast_float_mask, axis=1, keepdims=True
)
return inputs_exp / inputs_sum

Expand Down