def _retrace_weights(pi_probs, mu_probs):
  """Evaluates importance weights for the Retrace algorithm.

  Args:
    pi_probs: taken action probabilities according to target policy.
      Shape is `[T, B]`.
    mu_probs: taken action probabilities according to behaviour policy.
      Shape is `[T, B]`.

  Returns:
    Tensor of shape `[T, B]` containing importance weights.
  """
  # tf.minimum seems to handle potential NaNs when pi_probs[i]=mu_probs[i]=0
  return tf.minimum(1.0, pi_probs / mu_probs)
Evaluates importance weights for the Retrace algorithm.

  Args:
    pi_probs: taken action probabilities according to target policy.
      Shape is `[T, B]`.
    mu_probs: taken action probabilities according to behaviour policy.
      Shape is `[T, B]`.

  Returns:
    Tensor of shape `[T, B]` containing importance weights.
  
trfl/retrace_ops.py