Skip to content

EnsureChannelFirst: avoid re-creation of AddChannel#3649

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

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

Conversation

@rijobro
Copy link
Copy Markdown
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 <[email protected]>
@rijobro rijobro requested review from Nic-Ma and wyli January 12, 2022 14:08
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.

@wyli
Copy link
Copy Markdown
Contributor

wyli commented Jan 12, 2022

/build

@rijobro
Copy link
Copy Markdown
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.

@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
Copy Markdown
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