code: def test_custom_topk(dtype, k, dim):
      """Test custom topk implementation."""
      if dtype == torch.half and not _TORCH_GREATER_EQUAL_1_13:
          pytest.skip(
              "half precision topk not supported in Pytorch < 1.13"
          )
      x = torch.randn(100, 10, dtype=dtype)
      top_k = select_topk(x, dim=dim, topk=k)
      assert top_k.shape == (100, 10)
      assert top_k.dtype == torch.int
      ref = _reference_topk(x, dim=dim, k=k)
      assert torch.allclose(top_k, torch.from_numpy(ref).to(torch.int))
  
imports: import sys
  import numpy
  import pytest
  import torch
  from torch import tensor
  from torchmetrics.regression import MeanSquaredError, PearsonCorrCoef
  from torchmetrics.utilities import check_forward_full_state_property, rank_zero_debug, rank_zero_info, rank_zero_warn
  from torchmetrics.utilities.checks import _allclose_recursive
  from torchmetrics.utilities.data import _bincount, _cumsum, _flatten, _flatten_dict, select_topk, to_categorical, to_onehot
  from torchmetrics.utilities.distributed import class_reduce, reduce
  from torchmetrics.utilities.exceptions import TorchMetricsUserWarning
  from torchmetrics.utilities.imports import _TORCH_GREATER_EQUAL_1_13
label_desc: Use image node_id 14 for calling a global function with example usage: test_custom_topk(dtype, k, dim) without return types