-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Description
I'm working on a model that does M-step sampling from multinomial distribution. In numpy we use
numpy.random.multinomial(n, pvals, size=None)
whose 1st param is experiment time and 2nd param is probability distribution, which means if we'd like to sample M times it would create an array which sums up to M, for example, sample 20 times on a dice:
>>>np.random.multinomial(20, [1/6.]*6, size=1)
array([[4, 1, 7, 5, 2, 1]])
This can be seen as a histogram on 20 samples.
While using pytorch we seems not to have this feature. torch.multinomial()
only samples one at a time so we have to write FOR loop manually.
This feature's important to me, I don't know it would help anyone else or not.
Metadata
Metadata
Assignees
Labels
No labels