code: def test_category_accuracy(
      preds: torch.Tensor,
      target: torch.Tensor,
      output: torch.Tensor,
      one_hot: bool,
  ):
      if one_hot:
          target = torch.nn.functional.one_hot(
              target.long(), num_classes=6
          ).float()
      metric = metric_modules.CategoryAccuracy(num_classes=6)
      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 12 for calling a global function with example usage: test_category_accuracy(preds, target, output, one_hot) without return types