Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnsureChannelFirst: avoid re-creation of AddChannel #3649

Merged

Conversation

rijobro
Copy link
Contributor

@rijobro rijobro commented Jan 12, 2022

Description

Each time EnsureChannelFirst.__call__ is called, AddChannel or AsChannelFirst is created and then immediately destroyed. Better to create both during the __init__ and then reuse.

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro rijobro requested review from wyli and Nic-Ma January 12, 2022 14:08
Copy link
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.

@wyli
Copy link
Contributor

wyli commented Jan 12, 2022

/build

@rijobro
Copy link
Contributor Author

rijobro commented Jan 12, 2022

Sorry, realise that since the channel dimension is determined during __call__, the AsChannelFirst object can't be created during the __init__. The AddChannel can, though.

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro rijobro enabled auto-merge (squash) January 12, 2022 14:24
@rijobro rijobro changed the title EnsureChannelFirst: avoid re-creation of AddChannel and AsChannelFirst EnsureChannelFirst: avoid re-creation of AddChannel Jan 12, 2022
@wyli
Copy link
Contributor

wyli commented Jan 12, 2022

/build

@rijobro rijobro merged commit 35c2b37 into Project-MONAI:dev Jan 12, 2022
@rijobro rijobro deleted the ensure_channel_first_avoid_object_recreation branch January 13, 2022 12:01
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