Returns the Callback Model for this Model.
(self)
| 1762 | return total_loss |
| 1763 | |
| 1764 | def _get_callback_model(self): |
| 1765 | """Returns the Callback Model for this Model.""" |
| 1766 | |
| 1767 | if hasattr(self, '_replicated_model') and self._replicated_model: |
| 1768 | # When using training_distributed, we set the callback model |
| 1769 | # to an instance of the `DistributedModel` that we create in |
| 1770 | # the `compile` call. The `DistributedModel` is initialized |
| 1771 | # with the first replicated model. We need to set the callback |
| 1772 | # model to a DistributedModel to allow us to override saving |
| 1773 | # and loading weights when we checkpoint the model during training. |
| 1774 | return self._replicated_model |
| 1775 | if hasattr(self, 'callback_model') and self.callback_model: |
| 1776 | return self.callback_model |
| 1777 | return self |
| 1778 | |
| 1779 | def _make_callback_model(self, grouped_model): |
| 1780 | first_replicated_model = self._distribution_strategy.unwrap( |
no outgoing calls
no test coverage detected