class_docstr: Test various loss functions in model_utils.
class_docstr_tok: ["Test","various","loss","functions","in","model_utils","."]
docstr: Test weighted_l1_loss against a manually specified target.
docstr_tok: ["Test","weighted_l1_loss","against","a","manually","specified","target","."]
code: def test_weighted_l1_loss(self):
      """Test weighted_l1_loss against a manually specified target."""
      x = jnp.array([[0.1, 0.3], [-1.0, 0.2]], dtype=jnp.float32)
      y = jnp.array([[0.5, -1.3], [0.9, 1.2]], dtype=jnp.float32)
  
      out1 = model_utils.weighted_l1_loss(x, y, reduction=None)
      out1_target = jnp.array(
          [[0.4, 1.6], [1.9, 1.0]], dtype=jnp.float32
      )
      self.assertSequenceAlmostEqual(
          out1.flatten(), out1_target.flatten(), places=5
      )
  
      out2 = model_utils.weighted_l1_loss(x, y, reduction="mean").item()
      out2_target = 4.9 / 4
      self.assertAlmostEqual(out2, out2_target, places=5)
  
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 1 for calling the LossTest obj's underlying member method code with example usage: obj.test_weighted_l1_loss() without return types