code: def _pd_tschuprows_t(preds, target):
      preds = preds.argmax(1) if preds.ndim == 2 else preds
      target = target.argmax(1) if target.ndim == 2 else target
      preds, target = preds.numpy().astype(int), target.numpy().astype(
          int
      )
      observed_values = pd.crosstab(preds, target)
  
      t = association(observed=observed_values, method="tschuprow")
      return torch.tensor(t)
  
file_path: torchmetrics/tests/unittests/nominal/test_tschuprows.py
imports: import itertools
  import operator
  import pandas
  import pytest
  import torch
  from lightning_utilities.core.imports import compare_version
  from scipy.stats.contingency import association
  from torchmetrics.functional.nominal.tschuprows import tschuprows_t, tschuprows_t_matrix
  from torchmetrics.nominal.tschuprows import TschuprowsT
  from unittests import BATCH_SIZE, NUM_BATCHES, _Input
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 2 for calling a global function with example usage: _pd_tschuprows_t(preds, target) and returns: torch