def test_step(self, data):
    (targets, references) = self.compute_targets(data)
    logits = self([data, targets], training=False)
    avg_loss = self._caption_loss(targets, logits)
    decoded = self([data, None], training=False)
    self.compute_caption_metrics(decoded, references)
    self.model_metrics['loss'].update_state(avg_loss)
    return {m.name: m.result() for m in self.model_metrics.values()}
def test_step(self, data):
    (targets, references) = self.compute_targets(data)
    logits = self([data, targets], training=False)
    avg_loss = self._caption_loss(targets, logits)
    decoded = self([data, None], training=False)
    self.compute_caption_metrics(decoded, references)
    self.model_metrics['loss'].update_state(avg_loss)
    return {m.name: m.result() for m in self.model_metrics.values()}