The tf.keras.Model.compile metrics do not respect masking since TF 2.2 #40002
Labels
comp:keras
Keras related issues
regression issue
To spot regression issues in latest version
TF 2.2
Issues related to TF 2.2
type:bug
Bug
Projects
System information
Describe the current behavior
The metrics passed to
tf.keras.Model.compile
asmetrics
do not respect model masks.Describe the expected behavior
Until TF 2.1, these metrics did respect model masks.
Standalone code to reproduce the issue
Consider the following code which masks the input element.
TensorFlow until 2.1 masks also the metric in
metrics
, while TensorFlow 2.2 and later do not.[0.0, 0.0, 0.0]
[0.0, 1.0, 0.0]
[0.0, 1.0, 0.0]
Other info / logs
The logic of applying the mask in
master
is here:tensorflow/tensorflow/python/keras/engine/compile_utils.py
Lines 404 to 414 in a1ae008
The
metrics
do not get called withsample_weight
, but that is the place where the masks are applied (inapply_mask
).On the other hand, in TF 2.1
tensorflow/tensorflow/python/keras/engine/training.py
Lines 2000 to 2012 in 3ffdb91
the
output_mask
was passed even for the unweighted metrics.The text was updated successfully, but these errors were encountered: