torch.multinomial

A c-implementation for sampling a multinomial with or without replacement that returns a tensor of sampled indices.