softmax_cross_entropy_with_logits#

ray.rllib.utils.torch_utils.softmax_cross_entropy_with_logits(logits: NDArray[Any] | jnp.ndarray | tf.Tensor | torch.Tensor, labels: NDArray[Any] | jnp.ndarray | tf.Tensor | torch.Tensor) NDArray[Any] | jnp.ndarray | tf.Tensor | torch.Tensor[source]#

Same behavior as tf.nn.softmax_cross_entropy_with_logits.

Parameters:
  • x – The input predictions.

  • labels (NDArray[Any] | jnp.ndarray | tf.Tensor | torch.Tensor) – The labels corresponding to x.

Returns:

The resulting softmax cross-entropy given predictions and labels.

Return type:

NDArray[Any] | jnp.ndarray | tf.Tensor | torch.Tensor