code: def _multi_target_sk_r2score(
      preds, target, adjusted=0, multioutput="raw_values"
  ):
      """Compute R2 score over multiple outputs."""
      sk_preds = preds.view(-1, num_targets).numpy()
      sk_target = target.view(-1, num_targets).numpy()
      r2_score = sk_r2score(
          sk_target, sk_preds, multioutput=multioutput
      )
      if adjusted != 0:
          return 1 - (1 - r2_score) * (sk_preds.shape[0] - 1) / (
              sk_preds.shape[0] - adjusted - 1
          )
      return r2_score
  
imports: from functools import partial
  from typing import Any
  import pytest
  import torch
  from sklearn.metrics import accuracy_score
  from sklearn.metrics import r2_score
  from torch import Tensor, tensor
  from torchmetrics import Metric
  from torchmetrics.classification import ConfusionMatrix, MulticlassAccuracy
  from torchmetrics.regression import R2Score
  from torchmetrics.wrappers.multioutput import MultioutputWrapper
  from unittests import BATCH_SIZE, NUM_BATCHES, NUM_CLASSES, _Input
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 1 for calling a global function with example usage: _multi_target_sk_r2score(preds, target, adjusted, multioutput) and returns: r2_score, unknown