Skip to content

3610 Add ascontiguous utility and check in CacheDataset#3614

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

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

Conversation

@Nic-Ma
Copy link
Copy Markdown
Contributor

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

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 Nic-Ma marked this pull request as ready for review January 8, 2022 16:55
@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jan 8, 2022

/black

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jan 8, 2022

/build

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jan 8, 2022

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
Copy link
Copy Markdown
Contributor

@wyli wyli left a comment

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)

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jan 9, 2022

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
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jan 9, 2022

/black

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jan 9, 2022

/build

@wyli
Copy link
Copy Markdown
Contributor

wyli commented Jan 9, 2022

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

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jan 9, 2022

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
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jan 9, 2022

/black

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jan 9, 2022

/build

2 similar comments
@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jan 9, 2022

/build

@wyli
Copy link
Copy Markdown
Contributor

wyli commented Jan 9, 2022

/build

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

wyli commented Jan 9, 2022

/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 <[email protected]>

* [DLMED] add doc

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] enhance CacheDataset

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] add unit test

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] export to utility

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] add to subclasses

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] fix antipatterns

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

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] add doc

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] enhance CacheDataset

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] add unit test

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] export to utility

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] add to subclasses

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <[email protected]>

* [DLMED] fix antipatterns

Signed-off-by: Nic Ma <[email protected]>
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