Numpy.choice without replacement in mxnet


I am trying to find a working alternative for numpy’s choice function.

As far as I know ndarray.sample_multinomial(…) can do the job but only with replacement. Is there a non-hacky way of doing it without replacement?

The issue below discusses the same problem but without any answer:


I am not aware of such operator in MXNet. But it shouldn’t be too difficult to implement one using sample_multinomial(softmax()) or the Gumbel softmax sampling trick in a loop.