# tf.compat.v1.multinomial

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.14.0/tensorflow/python/ops/random_ops.py#L362-L391) |

Draws samples from a multinomial distribution. (deprecated)

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.random.multinomial`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/multinomial)

<br />

    tf.compat.v1.multinomial(
        logits, num_samples, seed=None, name=None, output_dtype=None
    )

> [!WARNING]
> **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use [`tf.random.categorical`](https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/random/categorical) instead.

#### Example:

    # samples has shape [1, 5], where each value is either 0 or 1 with equal
    # probability.
    samples = tf.random.categorical(tf.math.log([[0.5, 0.5]]), 5)

<br />

<br />

<br />

| ## Args ||
|---|---|
| `logits` | 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` represents the unnormalized log-probabilities for all classes. |
| `num_samples` | 0-D. Number of independent samples to draw for each row slice. |
| `seed` | A Python integer. Used to create a random seed for the distribution. See [`tf.random.set_seed`](https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/random/set_seed) for behavior. |
| `name` | Optional name for the operation. |
| `output_dtype` | The integer type of the output: `int32` or `int64`. Defaults to `int64`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The drawn samples of shape `[batch_size, num_samples]`. ||

<br />