code: def _multi_target_ref_metric(preds, target, sk_fn, metric_args):
      sk_preds = preds.view(-1, num_targets).numpy()
      sk_target = target.view(-1, num_targets).numpy()
      sk_kwargs = (
          {"multioutput": "raw_values"}
          if metric_args and "num_outputs" in metric_args
          else {}
      )
      res = sk_fn(sk_target, sk_preds, **sk_kwargs)
      return (
          math.sqrt(res)
          if (metric_args and not metric_args["squared"])
          else res
      )
  
imports: import math
  from functools import partial
  from typing import Optional
  import numpy
  import pytest
  import torch
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import mean_absolute_percentage_error
  from sklearn.metrics import mean_squared_error
  from sklearn.metrics import mean_squared_log_error
  from sklearn.metrics._regression import _check_reg_targets
  from sklearn.utils import check_consistent_length
  from torchmetrics.functional import mean_absolute_error, mean_absolute_percentage_error, mean_squared_error, mean_squared_log_error, weighted_mean_absolute_percentage_error
  from torchmetrics.functional.regression.symmetric_mape import symmetric_mean_absolute_percentage_error
  from torchmetrics.regression import MeanAbsoluteError, MeanAbsolutePercentageError, MeanSquaredError, MeanSquaredLogError, WeightedMeanAbsolutePercentageError
  from torchmetrics.regression.symmetric_mape import SymmetricMeanAbsolutePercentageError
  from unittests import BATCH_SIZE, NUM_BATCHES, _Input
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 4 for calling a global function with example usage: _multi_target_ref_metric(preds, target, sk_fn, metric_args) and returns: unknown