class_docstr: Tests the metric computation related utilities.
class_docstr_tok: ["Tests","the","metric","computation","related","utilities","."]
docstr: Tests the top1 correct computation.
docstr_tok: ["Tests","the","top1","correct","computation","."]
code: def test_weighted_top_one_correctly_classified(
      self, label_multiplier, weight_multiplier
  ):
      """Tests the top1 correct computation."""
      batch_size = 512
      num_of_classes = 100
      logits = jnp.array(
          np.random.normal(size=(batch_size, 50, num_of_classes)),
          dtype=jnp.float32,
      )
      labels = jnp.array(
          np.random.randint(0, 2, size=(batch_size, 50, num_of_classes))
      )
      labels *= label_multiplier
  
      weights = jnp.ones(shape=(batch_size,), dtype=jnp.float32)
      weights *= weight_multiplier
  
      is_correct_array = (
          model_utils.weighted_top_one_correctly_classified(
              logits, labels, weights=weights
          )
      )
      num_correct = jnp.sum(is_correct_array)
      is_correct_array_ref = (
          model_utils.weighted_topk_correctly_classified(
              logits, labels, weights, k=1
          )
      )
  
      np.testing.assert_array_almost_equal(
          is_correct_array, is_correct_array_ref
      )
      np.testing.assert_equal(
          np.sum(is_correct_array), np.sum(is_correct_array_ref)
      )
  
      self.is_valid(num_correct, "Number of correctly classified")
  
imports: import itertools
  from absl.testing import absltest
  from absl.testing import parameterized
  from flax.training import common_utils
  import jax
  import jax.numpy
  import numpy
  from scenic.model_lib.base_models import model_utils
label_desc: Use image node_id 4 for calling the MetricTest obj's underlying member method code with example usage: obj.test_weighted_top_one_correctly_classified(label_multiplier, weight_multiplier) without return types