My training data is like:
x_train = torch.tensor(torch.from_numpy(np.random.randint(100, size=(1000, 25))), dtype=torch.double)

where each row is a sample and thus we have 1000 samples.
Now I need to have the training data such that for each of the sample/row there can be at max 3 non-zero elements.
Can you all please suggest how I can implement that? Thanks!