• Creates a tf.Tensor with values drawn from a multinomial distribution.

    const probs = tf.tensor([.75, .25]);
    tf.multinomial(probs, 3).print();

    Parameters

    • logits: TensorLike | Tensor1D | Tensor2D

      1D array with unnormalized log-probabilities, or 2D array of shape [batchSize, numOutcomes]. See the normalized parameter.

    • numSamples: number

      Number of samples to draw for each row slice.

    • Optional seed: number

      The seed number.

    • Optional normalized: boolean

      Whether the provided logits are normalized true probabilities (sum to 1). Defaults to false.

    Returns Tensor1D | Tensor2D

    1D array of shape [numSamples], or 2D array of shape [batchSize, numSamples], depending on the rank of the input.

    Doc

Generated using TypeDoc