Torch equivalent of numpy.random.choice?

You could generate a random number between 0 and the size of the outer dimension of your tensor, and then use that to index into your tensor.

We don’t have a built-in function like numpy.random.choice.

2 Likes