def step()

in utils/logger.py [0:0]


    def step(self, args, stat_train, stat_val, elapsed, gpu_mem):
        if "err" in stat_train:
            print(
                "{}\ttrain: {:.2f}%\tval: {:.2f}%\tms/batch: {:.1f}\tgpu_mem: {:.1f}gb".format(
                    (args.ep + 1) * args.nbatches // args.update_freq,
                    stat_train["err"] * 100,
                    stat_val["err"] * 100,
                    elapsed,
                    gpu_mem,
                )
            )
            self.log("loss/train", stat_train["loss"])
            self.log("loss/val", stat_val["loss"])
            self.log("err/train", stat_train["err"])
            self.log("err/val", stat_val["err"])
        elif args.data_type == "char":
            print(
                "{}\ttrain: {:.2f}bpc\tval: {:.2f}bpc\tms/batch: {:.1f}\tgpu_mem: {:.1f}gb".format(
                    (args.ep + 1) * args.nbatches // args.update_freq,
                    stat_train["loss"] / math.log(2),
                    stat_val["loss"] / math.log(2),
                    elapsed,
                    gpu_mem,
                )
            )
            self.log("loss/train", stat_train["loss"] / math.log(2))
            self.log("loss/val", stat_val["loss"] / math.log(2))
        else:
            train_ppl = math.exp(min(stat_train["loss"], 30))  # avoid overflow
            val_ppl = math.exp(min(stat_val["loss"], 30))  # avoid overflow
            print(
                "{}\ttrain_ppl: {:.1f}\tval_ppl: {:.1f}\tms/batch: {:.1f}\tgpu_mem: {:.1f}gb".format(
                    (args.ep + 1) * args.nbatches // args.update_freq,
                    train_ppl,
                    val_ppl,
                    elapsed,
                    gpu_mem,
                )
            )
            self.log("loss/train", stat_train["loss"])
            self.log("loss/val", stat_val["loss"])
            self.log("loss/ppl_train", train_ppl)
            self.log("loss/ppl_val", val_ppl)
        self.log("X", (args.ep + 1) * args.nbatches // args.update_freq)

        if args.plot:
            self.log("compute/gpu_mem_gb", gpu_mem)
            self.log("compute/batch_time_ms", elapsed)
            self.plot_step(-1)
            self.writer.flush()