The SphericalSWEDataset class currently implements the __getitem__ as follows:
def __getitem__(self, index):
with torch.inference_mode():
with torch.no_grad():
inp, tar = self._get_sample()
if self.normalize:
inp = (inp - self.inp_mean) / torch.sqrt(self.inp_var)
tar = (tar - self.inp_mean) / torch.sqrt(self.inp_var)
return {'x': inp.clone(), 'y': tar.clone()}
which ignores the index completely. This allows to access the dataset with any arbritary key:
dataset = test_loader.dataset
dataset['foo'] # returns a sample
dataset['anotherkey'] # returns another sample
Expected behaviour is: Just not be able to use keys alltogether or receive a KeyError or something like that.
The
SphericalSWEDatasetclass currently implements the__getitem__as follows:which ignores the index completely. This allows to access the dataset with any arbritary key:
Expected behaviour is: Just not be able to use keys alltogether or receive a KeyError or something like that.