Skip to content

Commit

Permalink
Add support for keras model.compiled_metrics and model.compiled_loss …
Browse files Browse the repository at this point in the history
…that are None.

PiperOrigin-RevId: 365835530
  • Loading branch information
mdreves authored and tf-model-analysis-team committed Mar 30, 2021
1 parent edf0bbc commit 78a01f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tensorflow_model_analysis/evaluators/keras_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def metric_computations_using_keras_saved_model(
# need to call model.evaluate.
if not model.metrics:
return []
elif (hasattr(model, 'compiled_metrics') and
hasattr(model, 'compiled_loss') and
elif (hasattr(model, 'compiled_metrics') and model.compiled_metrics and
hasattr(model, 'compiled_loss') and model.compiled_loss and
len(model.compiled_metrics.metrics) + len(model.compiled_loss.metrics)
== len(model.metrics)):
output_names = model.output_names if hasattr(model, 'output_names') else []
Expand Down

0 comments on commit 78a01f6

Please sign in to comment.