Get dataset sample size

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

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