Skip to content

Commit

Permalink
remove: shuffle=False option (Project-MONAI#6886)
Browse files Browse the repository at this point in the history
Fixes Project-MONAI#6885 

### Description

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Amirreza Aflakparast <[email protected]>
Signed-off-by: monai-bot <[email protected]>
Co-authored-by: monai-bot <[email protected]>
  • Loading branch information
AmirAflak and monai-bot authored Aug 18, 2023
1 parent 4cd717c commit 6e47140
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions monai/data/samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class DistributedWeightedRandomSampler(DistributedSampler):
by default, `world_size` is retrieved from the current distributed group.
rank: rank of the current process within `num_replicas`. by default,
`rank` is retrieved from the current distributed group.
shuffle: if `True`, sampler will shuffle the indices, default to True.
kwargs: additional arguments for `DistributedSampler` super class, can be `seed` and `drop_last`.
"""
Expand All @@ -95,17 +94,10 @@ def __init__(
even_divisible: bool = True,
num_replicas: int | None = None,
rank: int | None = None,
shuffle: bool = True,
**kwargs,
):
super().__init__(
dataset=dataset,
even_divisible=even_divisible,
num_replicas=num_replicas,
rank=rank,
shuffle=shuffle,
**kwargs,
)
kwargs.setdefault("shuffle", True)
super().__init__(dataset=dataset, even_divisible=even_divisible, num_replicas=num_replicas, rank=rank, **kwargs)
self.weights = weights
self.num_samples_per_rank = num_samples_per_rank if num_samples_per_rank is not None else self.num_samples
self.generator = generator
Expand Down
2 changes: 1 addition & 1 deletion monai/losses/adversarial_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def forward(
"to False. To optimise a generator, target_is_real must be set to True."
)

if type(input) is not list:
if not isinstance(input, list):
input = [input]
target_ = []
for _, disc_out in enumerate(input):
Expand Down

0 comments on commit 6e47140

Please sign in to comment.