code: def categorical(
      q_tm1: networks.DiscreteValuedDistribution,
      r_t: tf.Tensor,
      d_t: tf.Tensor,
      q_t: networks.DiscreteValuedDistribution,
  ) -> tf.Tensor:
      """Implements the Categorical Distributional TD(0)-learning loss."""
  
      z_t = (
          tf.reshape(r_t, (-1, 1))
          + tf.reshape(d_t, (-1, 1)) * q_t.values
      )
      p_t = tf.nn.softmax(q_t.logits)
  
      # Performs L2 projection.
      target = tf.stop_gradient(l2_project(z_t, p_t, q_t.values))
  
      # Calculates loss.
      loss = tf.nn.softmax_cross_entropy_with_logits(
          logits=q_tm1.logits, labels=target
      )
  
      return loss
  
imports: from acme.tf import networks
  import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: categorical(q_tm1, r_t, d_t, q_t) and returns: loss