• Computes the softmax normalized vector given the logits.

    const a = tf.tensor1d([1, 2, 3]);

    a.softmax().print(); // or tf.softmax(a)
    const a = tf.tensor2d([2, 4, 6, 1, 2, 3], [2, 3]);

    a.softmax().print(); // or tf.softmax(a)

    Type Parameters

    Parameters

    • logits: TensorLike | T

      The logits array.

    • Optionaldim: number

      The dimension softmax would be performed on. Defaults to -1 which indicates the last dimension.

    Returns T