code: def verb_phrase_nce(
      encoded_video: jnp.ndarray,
      encoded_text: jnp.ndarray,
      batch_mask_verb: jnp.ndarray,
      temperature: float = 0.05,
  ) -> float:
      """Returns NCE loss for video to verb loss."""
      logits = utils.compute_inners(encoded_video, encoded_text)
      labels, masking = get_labels_verbs(logits, batch_mask_verb)
      logits = logits + masking
      logits = logits / temperature
      loss = -jnp.sum(labels * nn.log_softmax(logits, axis=-1), axis=-1)
      loss = jnp.sum(loss * jnp.squeeze(batch_mask_verb)) / jnp.sum(
          batch_mask_verb
      )
      loss_final = loss / jnp.log(jnp.sum(batch_mask_verb))
      return loss_final
  
file_path: scenic/scenic/projects/verbs_in_action/losses.py
imports: from typing import Tuple
  import flax.linen
  import jax.numpy
  import numpy
  from scenic.projects.verbs_in_action import utils
label_desc: Use image node_id 6 for calling a global function with example usage: verb_phrase_nce(encoded_video, encoded_text, batch_mask_verb, temperature) and returns: loss_final