Pytorch中是否有类似于NumPy的"numpy.random.choice"函数的方法?
在Pytorch中有没有和NumPy里的“numpy.random.choice”函数一样的方法?
1 个回答
0
你可以试试torch.randint这个函数。它可以用来生成一些随机数据,比如说在0到n的范围内,生成大小为m的数据。
sample = torch.randint(low=0, high=n, size(m,))