code: def test_loss():
      loss_calculator = Loss(average=True)
      loss = list()
      loss_calculator.reset()
      for _ in range(10):
          epoch_loss = np.random.uniform(0, 1)
          loss.append(epoch_loss)
          loss_calculator.update(epoch_loss)
  
      assert np.around(np.array(loss).mean(), decimals=4) == np.around(
          loss_calculator.value, decimals=4
      )
  
      loss_calculator = Loss(average=False)
      loss = list()
      loss_calculator.reset()
      for _ in range(10):
          epoch_loss = np.random.uniform(0, 1)
          loss.append(epoch_loss)
          loss_calculator.update(epoch_loss)
  
      assert np.allclose(np.array(loss), loss_calculator.value)
  
imports: import os
  from pathlib import Path
  import numpy
  import pytest
  import shutil
  import torch
  from hypothesis import given
  from torch_hypothesis import classification_logits_and_labels
  from baal.utils.metrics import Loss, Accuracy, Precision, ECE, ClassificationReport, PRAuC, ECE_PerCLs
label_desc: Use image node_id 1 for calling a global function with example usage: test_loss() without return types