Get dataset sample size

Is there and elegant way to get the shape of an image in without using getitem?
Would like to use it to dynamically initialize my network module according to the image size before running on the dataset.

there isn’t, but you can get the first item and throw away the iterator and iterate freshly on the dataset during training. this operation should be quite cheap.

1 Like