To get all indices, you could just create a range operation using indices = range(len(dataset)).
If you want to get the current indices for the batch, my code example should work.
Do you run into any issues with this code snippet?