Skip to content

2554 Add channel dim if necessary#2555

Merged
Nic-Ma merged 7 commits intoProject-MONAI:devfrom
Nic-Ma:2554-add-channel-dim
Jul 8, 2021
Merged

2554 Add channel dim if necessary#2555
Nic-Ma merged 7 commits intoProject-MONAI:devfrom
Nic-Ma:2554-add-channel-dim

Conversation

@Nic-Ma
Copy link
Copy Markdown
Contributor

@Nic-Ma Nic-Ma commented Jul 8, 2021

Fixes #2554 .

Description

This PR added the channel dim if passing a scalar label tensor, also added the unit tests to cover it.

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

Nic-Ma commented Jul 8, 2021

/black

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jul 8, 2021

Just realized that one_hot utility already has a similar logic to add channel dim internally:
https://github.com/Project-MONAI/MONAI/blob/dev/monai/networks/utils.py#L74
Updated the PR to remove the redundant logic in One-Hot and keep the unit tests for it.

Thanks.

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jul 8, 2021

/black

@Nic-Ma
Copy link
Copy Markdown
Contributor Author

Nic-Ma commented Jul 8, 2021

/build

@Nic-Ma Nic-Ma enabled auto-merge (squash) July 8, 2021 06:35
@Nic-Ma Nic-Ma merged commit e95500a into Project-MONAI:dev Jul 8, 2021
@madil90
Copy link
Copy Markdown
Contributor

madil90 commented Jul 8, 2021

/build

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.

AsDiscrete needs to add channel dim for scalar label values

4 participants