Random.choices in pytorch

Hi
I want to choose random elements from a list with a weighting similar to np.random.choices, but I couldn’t find it in pytorch. Anyways, let’s call it T.
Now, I want to check elements of N=1x256x256 and see any of them is equal to elements of T. If they were the same change them to 0, and if they weren’t change them to 255.
I basically want to make a random mask.

I wondered if you could give me the right lines to do it in pytorch.

torch.mulinominal()