code: def record_stat(stat_history, all_loss):
      past_loss = stat_history["tmp_loss"]
      tr_loss, tr_rep_loss, tr_cls_loss, tr_att_loss = (
          past_loss[0] + all_loss[0].item(),
          past_loss[1] + all_loss[1],
          past_loss[2] + all_loss[2],
          past_loss[3] + all_loss[3],
      )
      stat_history["tmp_loss"] = [
          tr_loss,
          tr_rep_loss,
          tr_cls_loss,
          tr_att_loss,
      ]
      return stat_history
  
imports: import torch
  from torch.nn import CrossEntropyLoss, MSELoss
  import datasets
  from datasets import load_dataset, load_metric
  import copy
  import os
  import json
  import transformers
  from transformers import AutoConfig, PretrainedConfig
  import huggingface_transformer
  from huggingface_transformer.modeling_bert import BertForSequenceClassification
  import logging
  import numpy
  import math
label_desc: Use image node_id 10 for calling a global function with example usage: record_stat(stat_history, all_loss) and returns: stat_history