def __call__(self, engine, logger, event_name):
    if (not isinstance(logger, TensorboardLogger)):
        raise RuntimeError("Handler 'OutputHandler' works only with TensorboardLogger")
    metrics = self._setup_output_metrics(engine)
    engine = (engine if ((not hasattr(self, 'another_engine')) or (self.another_engine is None)) else self.another_engine)
    global_step = self.global_step_transform(engine, event_name)
    if (not isinstance(global_step, int)):
        raise TypeError('global_step must be int, got {}. Please check the output of global_step_transform.'.format(type(global_step)))
    for (key, value) in metrics.items():
        if (isinstance(value, numbers.Number) or (isinstance(value, torch.Tensor) and (value.ndimension() == 0))):
            logger.writer.add_scalar('{}/{}'.format(self.tag, key), value, global_step)
        elif (isinstance(value, torch.Tensor) and (value.ndimension() == 1)):
            for (i, v) in enumerate(value):
                logger.writer.add_scalar('{}/{}/{}'.format(self.tag, key, i), v.item(), global_step)
        else:
            warnings.warn('TensorboardLogger output_handler can not log metrics value type {}'.format(type(value)))
def __call__(self, engine, logger, event_name):
    if (not isinstance(logger, TensorboardLogger)):
        raise RuntimeError("Handler 'OutputHandler' works only with TensorboardLogger")
    metrics = self._setup_output_metrics(engine)
    engine = (engine if ((not hasattr(self, 'another_engine')) or (self.another_engine is None)) else self.another_engine)
    global_step = self.global_step_transform(engine, event_name)
    if (not isinstance(global_step, int)):
        raise TypeError('global_step must be int, got {}. Please check the output of global_step_transform.'.format(type(global_step)))
    for (key, value) in metrics.items():
        if (isinstance(value, numbers.Number) or (isinstance(value, torch.Tensor) and (value.ndimension() == 0))):
            logger.writer.add_scalar('{}/{}'.format(self.tag, key), value, global_step)
        elif (isinstance(value, torch.Tensor) and (value.ndimension() == 1)):
            for (i, v) in enumerate(value):
                logger.writer.add_scalar('{}/{}/{}'.format(self.tag, key, i), v.item(), global_step)
        else:
            warnings.warn('TensorboardLogger output_handler can not log metrics value type {}'.format(type(value)))