def _setup_output_metrics(self, engine):
        """Helper method to setup metrics to log
        """
        metrics = {}
        if self.metric_names is not None:
            for name in self.metric_names:
                if name not in engine.state.metrics:
                    warnings.warn("Provided metric name '{}' is missing "
                                  "in engine's state metrics: {}".format(name, list(engine.state.metrics.keys())))
                    continue
                metrics[name] = engine.state.metrics[name]

        if self.output_transform is not None:
            output_dict = self.output_transform(engine.state.output)

            if not isinstance(output_dict, dict):
                output_dict = {"output": output_dict}

            metrics.update({name: value for name, value in output_dict.items()})
        return metrics
Helper method to setup metrics to log