def __call__(self, engine, logger, event_name):
    if (not isinstance(logger, TensorboardLogger)):
        raise RuntimeError("Handler 'WeightsHistHandler' works only with TensorboardLogger")
    global_step = self.global_step_transform(engine, event_name)
    tag_prefix = ('{}/'.format(self.tag) if self.tag else '')
    for (name, p) in self.model.named_parameters():
        if (p.grad is None):
            continue
        name = name.replace('.', '/')
        logger.writer.add_histogram(tag='{}weights/{}'.format(tag_prefix, name), values=p.data.detach().cpu().numpy(), global_step=global_step)
def __call__(self, engine, logger, event_name):
    if (not isinstance(logger, TensorboardLogger)):
        raise RuntimeError("Handler 'WeightsHistHandler' works only with TensorboardLogger")
    global_step = self.global_step_transform(engine, event_name)
    tag_prefix = ('{}/'.format(self.tag) if self.tag else )
    for (name, p) in self.model.named_parameters():
        if (p.grad is None):
            continue
        name = name.replace('.', '/')
        logger.writer.add_histogram(tag='{}weights/{}'.format(tag_prefix, name), values=p.data.detach().cpu().numpy(), global_step=global_step)