class_docstr: Test class for `R2Score` metric.
docstr: Test class implementation of metric.
docstr_tok: ["Test","class","implementation","of","metric","."]
code: def test_r2(
      self,
      adjusted,
      multioutput,
      preds,
      target,
      ref_metric,
      num_outputs,
      ddp,
  ):
      """Test class implementation of metric."""
      self.run_class_metric_test(
          ddp,
          preds,
          target,
          R2Score,
          partial(
              ref_metric, adjusted=adjusted, multioutput=multioutput
          ),
          metric_args={
              "adjusted": adjusted,
              "multioutput": multioutput,
              "num_outputs": num_outputs,
          },
      )
  
imports: from functools import partial
  import pytest
  import torch
  from sklearn.metrics import r2_score
  from torchmetrics.functional import r2_score
  from torchmetrics.regression import R2Score
  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 the TestR2Score obj's underlying member method code with example usage: obj.test_r2(adjusted, multioutput, preds, target, ref_metric, num_outputs, ddp) without return types