Have I written custom code (as opposed to using a stock example script provided in Keras): no
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): CentOS
TensorFlow installed from (source or binary): PYPI
TensorFlow version (use command below): 2.11.0
Python version: 3.7.12
Describe the problem.
According to https://www.tensorflow.org/api_docs/python/tf/keras/layers/RNN the zero_output_for_mask only gets applied, when return_sequences=True. However, this gets ignored when go_backwards=True. As can be seen in the reproducer, while zero_output_for_mask has no effect in go_backwards=False, it has if True.
Describe the current behavior.
All values get zeroed although zero_output_for_mask should not apply in cases where return_sequences=False.
Describe the expected behavior.
The layer should work as described in the documentation.
System information.
Describe the problem.
According to https://www.tensorflow.org/api_docs/python/tf/keras/layers/RNN the
zero_output_for_mask
only gets applied, whenreturn_sequences=True
. However, this gets ignored whengo_backwards=True
. As can be seen in the reproducer, whilezero_output_for_mask
has no effect ingo_backwards=False
, it has ifTrue
.Describe the current behavior. All values get zeroed although
zero_output_for_mask
should not apply in cases wherereturn_sequences=False
.Describe the expected behavior. The layer should work as described in the documentation.
Contributing.
I have not looked into details yet, but I assume that there is something wrong with the conditions within the
go_backwards=True
path.Standalone code to reproduce the issue.
Source code / logs.