code: def test_weighted(self):
      self.setup()
      cosine_obj = metrics.CosineSimilarity()
      sample_weight = np.asarray([1.2, 3.4])
      loss = cosine_obj(
          self.y_true, self.y_pred, sample_weight=sample_weight
      )
      expected_loss = np.sum(
          self.expected_loss * sample_weight
      ) / np.sum(sample_weight)
      self.assertAlmostEqual(loss, expected_loss, 3)
  
imports: import numpy
  from absl.testing import parameterized
  from keras import testing
  from keras.metrics import regression_metrics
label_desc: Use image node_id 5 for calling the CosineSimilarityTest obj's underlying member method code with example usage: obj.test_weighted() without return types