Functionally is torch.multinomial the same as torch.distributions.categorical.Categorical?
Asked Answered
H

1

7

For example, if I provide a probability array of [0.5, 0.5], both functions will sample the index [0,1] with equal probability?

Hex answered 1/10, 2021 at 8:50 Comment(0)
V
7

Yes:

[torch.distributions.categorical.Categorical()] is equivalent to the distribution that torch.multinomial() samples from.

Vardon answered 1/10, 2021 at 10:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.