Skip to content

EnsureChannelFirst: avoid re-creation of AddChannel#3649

Merged
rijobro merged 3 commits into
Project-MONAI:devfrom
rijobro:ensure_channel_first_avoid_object_recreation
Jan 12, 2022
Merged

EnsureChannelFirst: avoid re-creation of AddChannel#3649
rijobro merged 3 commits into
Project-MONAI:devfrom
rijobro:ensure_channel_first_avoid_object_recreation

Conversation

@rijobro

@rijobro rijobro commented Jan 12, 2022

Copy link
Copy Markdown
Contributor

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 Nic-Ma and wyli January 12, 2022 14:08

@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.

@wyli

wyli commented Jan 12, 2022

Copy link
Copy Markdown
Contributor

/build

@rijobro

rijobro commented Jan 12, 2022

Copy link
Copy Markdown
Contributor Author

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

wyli commented Jan 12, 2022

Copy link
Copy Markdown
Contributor

/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