class_docstr: Test class for `TheilsU` metric.
class_docstr_tok: ["Test","class","for","`","TheilsU","`","metric","."]
docstr: Test the differentiability of the metric, according to its `is_differentiable` attribute.
docstr_tok: ["Test","the","differentiability","of","the","metric",",","according","to","its","`","is_differentiable","`","attribute","."]
code: def test_theils_u_differentiability(
      self, preds, target, nan_strategy, nan_replace_value
  ):
      """Test the differentiability of the metric, according to its `is_differentiable` attribute."""
      metric_args = {
          "nan_strategy": nan_strategy,
          "nan_replace_value": nan_replace_value,
          "num_classes": NUM_CLASSES,
      }
      self.run_differentiability_test(
          preds,
          target,
          metric_module=TheilsU,
          metric_functional=theils_u,
          metric_args=metric_args,
      )
  
file_path: torchmetrics/tests/unittests/nominal/test_theils_u.py
imports: import itertools
  import operator
  from functools import partial
  import pytest
  import torch
  from dython.nominal import theils_u
  from lightning_utilities.core.imports import compare_version
  from torchmetrics.functional.nominal.theils_u import theils_u, theils_u_matrix
  from torchmetrics.nominal import TheilsU
  from unittests import BATCH_SIZE, NUM_BATCHES, _Input
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 3 for calling the TestTheilsU obj's underlying member method code with example usage: obj.test_theils_u_differentiability(preds, target, nan_strategy, nan_replace_value) without return types