def METHOD_NAME(self, trainer, n=0):
    """Fetch latest n values or all values, process tensor type, convert to numpy for dump logs."""
    assert n >= 0
    for key in trainer.log_buffer.val_history:
        values = trainer.log_buffer.val_history[key][-n:]
        for i, v in enumerate(values):
            if isinstance(v, torch.Tensor):
                values[i] = v.clone().detach().cpu().numpy()
        trainer.log_buffer.val_history[key][-n:] = values