def METHOD_NAME(module, inputs, outputs):
    nonlocal header
    nonlocal fp
    if trainer.training:
        values = []
        headers = []
        for n, i in enumerate(inputs):
            if isinstance(i, torch.Tensor) and (
                i.dtype == torch.float or i.dtype == torch.half or i.dtype == torch.bfloat16
            ):
                if not header:
                    headers.append('input')
                input_norm = i.data.norm()
                values.append(f'{input_norm}')
                logger(f'debug_info_forward/{name}_rank{rank}_input{n}', input_norm)
        if isinstance(outputs, tuple):
            for n, i in enumerate(outputs):
                if isinstance(i, torch.Tensor) and (
                    i.dtype == torch.float or i.dtype == torch.half or i.dtype == torch.bfloat16
                ):
                    if not header:
                        headers.append('output')
                    output_norm = i.data.norm()
                    values.append(f'{output_norm}')
                    logger(f'debug_info_forward/{name}_rank{rank}_output{n}', output_norm)
        else:
            headers.append('output')
            values.append(f'{outputs.data.norm()}')
        values.append(f'{trainer.global_step}')
        if not header:
            headers.append('step')
            fp.write(','.join(headers) + '\n')
            header = True
        fp.write(','.join(values) + '\n')
    fp.flush()