Solved by tux in post #3 
              
              
                If I understand correctly, you just want to generate a tensor which contains -1 and 1 values ? 
Would something like this work for you ? 
a = torch.Tensor([-1, 1])
idx = np.random.randint(2, size=your_shape)
noise = a[idx]

Edit : 
Furthermore, if you want to have some control on the number of 1 or …