keras-team / keras-core

A multi-backend implementation of the Keras API, with support for TensorFlow, JAX, and PyTorch.
Apache License 2.0
1.27k stars 115 forks source link

Fix summary when optimizer is None #879

Closed mattdangerw closed 11 months ago

mattdangerw commented 11 months ago

Optimizer can be None (e.g. for just running inference). We should be careful not to assume it is always set when printing out model summary.

codecov[bot] commented 11 months ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (beba6f1) 76.49% compared to head (060560c) 76.49%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #879 +/- ## ======================================= Coverage 76.49% 76.49% ======================================= Files 329 329 Lines 31334 31334 Branches 6100 6100 ======================================= Hits 23970 23970 Misses 5785 5785 Partials 1579 1579 ``` | [Flag](https://app.codecov.io/gh/keras-team/keras-core/pull/879/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | Coverage Δ | | |---|---|---| | [keras_core](https://app.codecov.io/gh/keras-team/keras-core/pull/879/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `76.40% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files Changed](https://app.codecov.io/gh/keras-team/keras-core/pull/879?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | Coverage Δ | | |---|---|---| | [keras\_core/utils/summary\_utils.py](https://app.codecov.io/gh/keras-team/keras-core/pull/879?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team#diff-a2VyYXNfY29yZS91dGlscy9zdW1tYXJ5X3V0aWxzLnB5) | `72.72% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

fchollet commented 11 months ago

FAILED keras_core/utils/summary_utils_test.py::SummaryUtilsTest::test_print_model_summary0 - NotImplementedError: fit not implemented for NumPy backend.

We should exclude the Numpy backend in the test.