Yes, __iter__ will return an iterator, which will return the indices sampled from rand_tensor.
And yes, you are right. rand_tensor uses the batch size as the “stride” and doesn’t use replacement, so you should be fine.