How do I index correctly?

Can someone tell me how I index correctly at the first assignment?


I suggest you to consider samples from real and fake directly into target array besides considering them seperately and then concatinating it, and try to use p_real only on fake and consider real full without modification or any splitting

1 Like

If you create two separate tensors for the sampled real and fake images, then concatenate them, you’ll end up losing their original order. Try instead to keep the original order by first creating the output tensor (target_images), then setting its values at the appropriate indexes.

Also, keep in mind that you want to sample each image not each pixel, otherwise you’ll have an error on the next assertion: Combine_sample assert.


I would advise to check the real.shape[0] in the torch.rand line.

 target_images[quest] = fake[quest]