code: def _single_target_ref_metric(
      preds, target, sk_fn=explained_variance_score
  ):
      sk_preds = preds.view(-1).numpy()
      sk_target = target.view(-1).numpy()
      return sk_fn(sk_target, sk_preds)
  
file_path: torchmetrics/tests/unittests/regression/test_explained_variance.py
imports: from functools import partial
  import pytest
  import torch
  from sklearn.metrics import explained_variance_score
  from torchmetrics.functional import explained_variance
  from torchmetrics.regression import ExplainedVariance
  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 1 for calling a global function with example usage: _single_target_ref_metric(preds, target, sk_fn) and returns: sk_fn