code: def test_r2_sklearn_comparison(multioutput):
      """Test against sklearn's implementation on random inputs."""
      for _ in range(10):
          actuals = np.random.rand(64, 3)
          preds = np.random.rand(64, 3)
          sample_weight = np.random.rand(64, 1)
          tensor_actuals = tf.constant(actuals, dtype=tf.float32)
          tensor_preds = tf.constant(preds, dtype=tf.float32)
          tensor_sample_weight = tf.constant(
              sample_weight, dtype=tf.float32
          )
          tensor_actuals = tf.cast(tensor_actuals, dtype=tf.float32)
          tensor_preds = tf.cast(tensor_preds, dtype=tf.float32)
          tensor_sample_weight = tf.cast(
              tensor_sample_weight, dtype=tf.float32
          )
          # Initialize
          r2_obj = initialize_vars(multioutput=multioutput)
          # Update
          update_obj_states(
              r2_obj,
              tensor_actuals,
              tensor_preds,
              sample_weight=tensor_sample_weight,
          )
          # Check results by comparing to results of scikit-learn r2 implementation
          sklearn_result = sklearn_r2_score(
              actuals,
              preds,
              sample_weight=sample_weight,
              multioutput=multioutput,
          )
          check_results(r2_obj, sklearn_result)
  
imports: import numpy
  import pytest
  import tensorflow
  from sklearn.metrics import r2_score
  from tensorflow_addons.metrics import RSquare
  from tensorflow_addons.metrics.r_square import _VALID_MULTIOUTPUT
label_desc: Use image node_id 12 for calling a global function with example usage: test_r2_sklearn_comparison(multioutput) without return types