Hi !
If you want to do :
a_numpy = np.array([1, 2, 3, 4])
p_numpy = np.array([0.1, 0.1, 0.1, 0.7])
b_numpy = np.random.choice(a_numpy, p=p_numpy)

You can use torch.multinomial 121 :
a = torch.tensor([1, 2, 3, 4])
p = torch.tensor([0.1, 0.1, 0.1, 0.7])
index = p.multinomial(num_samples=1, replacement=True)
b = a[index]

Here I used replacement=True because it is the default behavior of numpy.choice, even though is makes no difference when num_samples=1