How to decipher these 2 lines of code? What does it mean?
This is the code:
real_idx = torch.rand(len(real)) &gt; 0.2
real_selected = real[real_idx][: int(len(real)*p_real)]

p_real is actually 0.2
We're supposed to mix 2 tensors, namely the real and the fake tensor.

The first line creates a random mask the size of real. The second line applies this mask on real and slices out 20% the size of real from whatever the masking operation returned.
Now if what you meant to ask was why is this being done, then you'd have to give more details.
