code: def weighted_sigmoid_cross_entropy(
      logits: jnp.ndarray,
      multi_hot_targets: jnp.ndarray,
      weights: Optional[jnp.ndarray] = None,
      label_weights: Optional[jnp.ndarray] = None,
      label_smoothing: Optional[float] = None,
  ) -> jnp.ndarray:
      """Computes weighted sigmoid cross entropy given logits and targets.
  
      Args:
        logits: Output of model in shape [batch, ..., num_classes].
        multi_hot_targets: Multi-hot vector of shape [batch, ..., num_classes].
        weights: None or array of shape [batch x ...] (rank of one_hot_targets -1).
        label_weights: None or array of shape broadcastable to the shape of logits.
          Typically this would be [num_classes] and is the weight to apply to each
          label.
        label_smoothing: Scalar to use to smooth the one-hot labels.
  
      Returns:
        The mean cross entropy of the examples in the given batch as a scalar.
      """
      if weights is not None:
          normalization = weights.sum()
      else:
          normalization = np.prod(multi_hot_targets.shape[:-1])
  
      unnormalized_sigmoid_ce = (
          weighted_unnormalized_sigmoid_cross_entropy(
              logits,
              multi_hot_targets,
              weights=weights,
              label_weights=label_weights,
              label_smoothing=label_smoothing,
          )
      )
      return jnp.sum(unnormalized_sigmoid_ce) / (normalization + 1e-8)
  
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 13 for calling a global function with example usage: weighted_sigmoid_cross_entropy(logits, multi_hot_targets, weights, label_weights, label_smoothing) and returns: unknown