code: def test_hits_at_k_metric(
      preds: torch.Tensor,
      target: torch.Tensor,
      output: torch.Tensor,
      k: int,
  ):
      metric = metric_modules.HitsAtKMetric(num_classes=3, top_k=k)
      with metric.sync_context():
          metric.update(preds, target)
          assert torch.isclose(output, metric.compute(), rtol=0.0001)
  
imports: import pytest
  import torch
  from ludwig.distributed import init_dist_strategy
  from ludwig.modules import metric_modules
  from ludwig.schema.features.loss.loss import BWCEWLossConfig, SigmoidCrossEntropyLossConfig, SoftmaxCrossEntropyLossConfig
label_desc: Use image node_id 14 for calling a global function with example usage: test_hits_at_k_metric(preds, target, output, k) without return types