Skip to content

Add __len__ for DistributedWeightedRandomSampler#1766

Merged
Nic-Ma merged 5 commits into
Project-MONAI:masterfrom
Nic-Ma:add-len-weightedrandomsampler
Mar 15, 2021
Merged

Add __len__ for DistributedWeightedRandomSampler#1766
Nic-Ma merged 5 commits into
Project-MONAI:masterfrom
Nic-Ma:add-len-weightedrandomsampler

Conversation

@Nic-Ma

@Nic-Ma Nic-Ma commented Mar 15, 2021

Copy link
Copy Markdown
Contributor

Description

This PR added the __len__() API for DistributedWeightedRandomSampler, refer to the PyTorch source code:
https://github.com/pytorch/pytorch/blob/master/torch/utils/data/sampler.py#L189

Status

Ready

Types of changes

  • 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.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@Nic-Ma

Nic-Ma commented Mar 15, 2021

Copy link
Copy Markdown
Contributor Author

/black

@Nic-Ma Nic-Ma requested review from ericspod, rijobro and wyli March 15, 2021 10:43
Comment thread monai/data/samplers.py
Signed-off-by: Nic Ma <nma@nvidia.com>

@wyli wyli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@Nic-Ma Nic-Ma enabled auto-merge (squash) March 15, 2021 11:03
@Nic-Ma Nic-Ma merged commit 4670fd2 into Project-MONAI:master Mar 15, 2021
@Nic-Ma Nic-Ma deleted the add-len-weightedrandomsampler branch July 2, 2021 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants