Skip to content

Commit

Permalink
fix dataset length when batch size is larger than the dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
ziw-liu committed Oct 31, 2024
1 parent 42c49f5 commit 4bf1088
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions viscy/data/gpu_aug.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def train_dataloader(self) -> DataLoader:
persistent_workers=True if self.num_workers > 0 else False,
num_workers=self.num_workers,
pin_memory=self.pin_memory,
drop_last=True,
drop_last=False,
collate_fn=list_data_collate,
)

Expand Down Expand Up @@ -115,7 +115,7 @@ def __init__(
self.transform = transform

def __len__(self) -> int:
return len(self._cache_map)
return len(self._metadata_map)

def __getitem__(self, idx: int) -> dict[str, Tensor]:
position, time_idx, norm_meta = self._metadata_map[idx]
Expand Down

0 comments on commit 4bf1088

Please sign in to comment.