Skip to content

Commit

Permalink
Resolving Dataset and OneOf test fails
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Murray <[email protected]>
  • Loading branch information
atbenmurray committed Nov 6, 2023
1 parent 2c4a225 commit eeca204
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion monai/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def _transform(self, index: int):
Fetch single data item from `self.data`.
"""
data_i = self.data[index]
return apply_transform(self.transform, data_i) if self.transform is not None else data_i
return self.transform(data_i) if self.transform is not None else data_i

def __getitem__(self, index: int | slice | Sequence[int]):
"""
Expand Down
4 changes: 4 additions & 0 deletions monai/transforms/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,10 @@ def _normalize_probabilities(self, weights):
weights = weights / weights.sum()
return list(weights)

def __len__(self):
"""Return number of transformations."""
return len(tuple(transform_iterator(self, step_into_all=True)))

def flatten(self):
transforms = []
weights = []
Expand Down

0 comments on commit eeca204

Please sign in to comment.