Skip to content

Commit

Permalink
Fix dataset sample
Browse files Browse the repository at this point in the history
  • Loading branch information
ashnair1 committed Jul 20, 2024
1 parent f436d5f commit d72c56a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion torchgeo/datasets/cyclone.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def __getitem__(self, index: int) -> dict[str, Any]:

if self.transforms is not None:
sample = self.transforms(sample)
sample.update({x: features[x] for x in features if x != 'label'})

sample.update({x: features[x] for x in features if x != 'label'})

return sample

Expand Down
3 changes: 2 additions & 1 deletion torchgeo/datasets/quakeset.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def __getitem__(self, index: int) -> dict[str, Tensor]:

if self.transforms is not None:
sample = self.transforms(sample)
sample['magnitude'] = magnitude

sample['magnitude'] = magnitude

return sample

Expand Down
3 changes: 2 additions & 1 deletion torchgeo/datasets/skippd.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ def __getitem__(self, index: int) -> dict[str, str | Tensor]:

if self.transforms is not None:
sample = self.transforms(sample)
sample.update({x: features[x] for x in features if x != 'label'})

sample.update({x: features[x] for x in features if x != 'label'})

return sample

Expand Down
11 changes: 4 additions & 7 deletions torchgeo/datasets/sustainbench_crop_yield.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,10 @@ def __getitem__(self, index: int) -> dict[str, Tensor]:

if self.transforms is not None:
sample = self.transforms(sample)
sample.update(
{
x: self.features[index][x]
for x in self.features[index]
if x != 'label'
}
)

sample.update(
{x: self.features[index][x] for x in self.features[index] if x != 'label'}
)

return sample

Expand Down

0 comments on commit d72c56a

Please sign in to comment.