Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mebristo committed Dec 2, 2021
1 parent a960f80 commit f3f6dd2
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 1,015 deletions.
11 changes: 2 additions & 9 deletions InnerEye/ML/Histopathology/datamodules/base_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,11 @@
from torch.utils.data import DataLoader

from health_ml.utils.bag_utils import BagDataset, multibag_collate
from health_ml.utils.common_utils import _create_generator
from InnerEye.ML.Histopathology.datasets.base_dataset import TilesDataset
from InnerEye.ML.Histopathology.models.transforms import LoadTilesBatchd


def _create_generator(seed: Optional[int]) -> torch.Generator:
generator = torch.Generator()
if seed is None:
seed = int(torch.empty((), dtype=torch.int64).random_().item())
generator.manual_seed(seed)
return generator


class CacheMode(Enum):
NONE = 'none'
MEMORY = 'memory'
Expand All @@ -42,7 +35,7 @@ def __init__(self, root_path: Path, max_bag_size: int = 0, batch_size: int = 1,
will return all samples in each bag. If > 0 , bags larger than `max_bag_size` will yield
random subsets of instances.
:param batch_size: Number of slides to load per batch.
:param seed: PRNG seed to use for shuffling instances and bags. Note that randomness in
:param seed: pseudorandom number generator seed to use for shuffling instances and bags. Note that randomness in
train/val/test splits is handled independently in `get_splits()`. (default: `None`)
:param transform: A transform to apply to the source tiles dataset, or a composition of
transforms using `monai.transforms.Compose`. By default (`None`), applies `LoadTilesBatchd`.
Expand Down
Loading

0 comments on commit f3f6dd2

Please sign in to comment.