Skip to content

3610 Add ascontiguous utility and check in CacheDataset#3614

Merged
wyli merged 13 commits into
Project-MONAI:devfrom
Nic-Ma:3610-add-ascontiguous
Jan 9, 2022
Merged

3610 Add ascontiguous utility and check in CacheDataset#3614
wyli merged 13 commits into
Project-MONAI:devfrom
Nic-Ma:3610-add-ascontiguous

Conversation

@Nic-Ma

@Nic-Ma Nic-Ma commented Jan 8, 2022

Copy link
Copy Markdown
Contributor

Fixes #3610 .

Description

This PR added the ascontiguous utility and apply in CacheDataset.

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

Nic-Ma and others added 11 commits February 1, 2021 19:15
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma Nic-Ma marked this pull request as ready for review January 8, 2022 16:55
@Nic-Ma

Nic-Ma commented Jan 8, 2022

Copy link
Copy Markdown
Contributor Author

/black

@Nic-Ma

Nic-Ma commented Jan 8, 2022

Copy link
Copy Markdown
Contributor Author

/build

@Nic-Ma

Nic-Ma commented Jan 8, 2022

Copy link
Copy Markdown
Contributor Author

I verified the PR with spleen segmentation pipeline.

Thanks.

@Nic-Ma Nic-Ma requested review from ericspod, rijobro and wyli January 8, 2022 16:56
@Nic-Ma Nic-Ma changed the title [WIP] 3610 Add ascontiguous utility and check in CacheDataset 3610 Add ascontiguous utility and check in CacheDataset Jan 8, 2022
Comment thread monai/transforms/utils.py Outdated

@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, it looks good to me. (Torch contiguous can take additional parameters but I'm not sure if we need it at the moment. https://pytorch.org/docs/stable/generated/torch.Tensor.contiguous.html#torch.Tensor.contiguous)

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma

Nic-Ma commented Jan 9, 2022

Copy link
Copy Markdown
Contributor Author

Thanks, it looks good to me. (Torch contiguous can take additional parameters but I'm not sure if we need it at the moment. https://pytorch.org/docs/stable/generated/torch.Tensor.contiguous.html#torch.Tensor.contiguous)

Thanks for your review, sure, I added kwargs for Tensor in the latest commit but didn't provide the arg for CacheDataset and explicitly set the memory_format in CacheDataset.

Thanks.

@Nic-Ma

Nic-Ma commented Jan 9, 2022

Copy link
Copy Markdown
Contributor Author

/black

@Nic-Ma

Nic-Ma commented Jan 9, 2022

Copy link
Copy Markdown
Contributor Author

/build

@wyli

wyli commented Jan 9, 2022

Copy link
Copy Markdown
Contributor

Forgot to mention that 2 minor antipatterns were introduced: https://deepsource.io/gh/Project-MONAI/MONAI/run/a37b8f84-4ba2-4db2-b025-0ee5ee9ecc97/python/

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma

Nic-Ma commented Jan 9, 2022

Copy link
Copy Markdown
Contributor Author

Hi @wyli ,

Thanks for your reminder, I updated to fix the antipatterns and changed the utility function name to align with:
https://github.com/Project-MONAI/MONAI/blob/dev/monai/utils/type_conversion.py#L102

Thanks.

@Nic-Ma

Nic-Ma commented Jan 9, 2022

Copy link
Copy Markdown
Contributor Author

/black

@Nic-Ma

Nic-Ma commented Jan 9, 2022

Copy link
Copy Markdown
Contributor Author

/build

2 similar comments
@Nic-Ma

Nic-Ma commented Jan 9, 2022

Copy link
Copy Markdown
Contributor Author

/build

@wyli

wyli commented Jan 9, 2022

Copy link
Copy Markdown
Contributor

/build

@wyli wyli enabled auto-merge (squash) January 9, 2022 14:33
@wyli

wyli commented Jan 9, 2022

Copy link
Copy Markdown
Contributor

/build

@wyli wyli merged commit 3269851 into Project-MONAI:dev Jan 9, 2022
Can-Zhao pushed a commit to Can-Zhao/MONAI that referenced this pull request Jan 10, 2022
…I#3614)

* [DLMED] add ascontiguous

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add doc

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] enhance CacheDataset

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add unit test

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] export to utility

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add to subclasses

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix antipatterns

Signed-off-by: Nic Ma <nma@nvidia.com>
wyli pushed a commit that referenced this pull request Jan 10, 2022
* [DLMED] add ascontiguous

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add doc

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] enhance CacheDataset

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add unit test

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] export to utility

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add to subclasses

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix antipatterns

Signed-off-by: Nic Ma <nma@nvidia.com>
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.

Add AsContiguous utility transform

2 participants