It would be possible, if len(x) contains at least batch_size+1 samples, which doesn’t seem to be the case.
This loop won’t yield anything for lengths in [0, batch_size]:
batch_size = 32
for i in range(0, 32 - batch_size, batch_size):
    print(i)