code: def apply_label_smoothing(
      one_hot_targets: jnp.ndarray, label_smoothing: Optional[float]
  ) -> jnp.ndarray:
      """Apply label smoothing to the one-hot targets.
  
      Applies label smoothing such that the on-values are transformed from 1.0 to
      `1.0 - label_smoothing + label_smoothing / num_classes`, and the off-values
      are transformed from 0.0 to `label_smoothing / num_classes`.
      https://arxiv.org/abs/1512.00567
  
      Note that another way of performing label smoothing (which we don't use here)
      is to take `label_smoothing` mass from the on-values and distribute it to the
      off-values; in other words, transform the on-values to `1.0 - label_smoothing`
      and the  off-values to `label_smoothing / (num_classes - 1)`.
      http://jmlr.org/papers/v20/18-789.html
  
  
      Args:
        one_hot_targets: One-hot targets for an example, a [batch, ..., num_classes]
          float array.
        label_smoothing: A scalar in [0, 1] used to smooth the labels.
  
      Returns:
        A float array of the same shape as `one_hot_targets` with smoothed label
        values.
      """
      on_value = 1.0 - label_smoothing
      num_classes = one_hot_targets.shape[-1]
      off_value = label_smoothing / num_classes
      one_hot_targets = one_hot_targets * on_value + off_value
      return one_hot_targets
  
imports: import functools
  from typing import Optional, Any, Tuple, Union
  import flax.linen
  import jax
  import jax.numpy
  import numpy
label_desc: Use image node_id 9 for calling a global function with example usage: apply_label_smoothing(one_hot_targets, label_smoothing) and returns: one_hot_targets