code: def test_that_accuracy_metric_calculates_top_k_correctly(y_ypred):
      predicted, true = y_ypred
      predicted = (
          predicted.softmax(-1) + torch.randn_like(predicted) / 100
      )
      last_accuracy = 0
      for k in range(1, predicted.size(1) + 1):
          accuracy_calculator = Accuracy(average=True, topk=(k,))
          accuracy_calculator.update(predicted, true)
          assert 1 >= accuracy_calculator.value >= last_accuracy
          last_accuracy = accuracy_calculator.value
  
      accuracy_calculator = Accuracy(
          average=True, topk=tuple(range(1, predicted.size(1) + 1))
      )
      accuracy_calculator.update(predicted, true)
      assert all(
          val_1 >= val_0
          for val_0, val_1 in zip(
              accuracy_calculator.value[::2],
              accuracy_calculator.value[1::2],
          )
      )
  
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 3 for calling a global function with example usage: test_that_accuracy_metric_calculates_top_k_correctly(y_ypred) without return types