We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef6e9af commit 138b5c2Copy full SHA for 138b5c2
torchvision/datasets/fakedata.py
@@ -37,6 +37,8 @@ def __getitem__(self, index):
37
tuple: (image, target) where target is class_index of the target class.
38
"""
39
# create random image that is consistent with the index id
40
+ if index >= len(self):
41
+ raise IndexError("{} index out of range".format(self.__class__.__name__))
42
rng_state = torch.get_rng_state()
43
torch.manual_seed(index + self.random_offset)
44
img = torch.randn(*self.image_size)
0 commit comments