@ptrblck,
I am using custom sampler. I am getting this error (before and after applying your code).
ValueError: 1 is not in range
Full error post is here 1.
I am not sure what is happening! Trying to create my Custom Dataset but not working at all!