Skip to content

Enhance ExtractDataKeyFromMetaKeyd to work with MetaTensor #8424

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

AdamaSorho
Copy link

Fixes #7562 .

Description

This pull request improves ExtractDataKeyFromMetaKey, enabling it to extract keys from a MetaTensor.

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).
  • [ x] New tests added to cover the changes.
  • [x ] Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • [ x] 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.

@ericspod ericspod requested review from ericspod, Nic-Ma and KumoLiu April 22, 2025 15:24
Comment on lines 63 to 69

if isinstance(d[self.meta_key], MetaTensor):
# meta tensor
meta = d[self.meta_key].meta
else:
# meta dict
meta = d[self.meta_key]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if isinstance(d[self.meta_key], MetaTensor):
# meta tensor
meta = d[self.meta_key].meta
else:
# meta dict
meta = d[self.meta_key]
meta: dict[str, Any]
if isinstance(d[self.meta_key], MetaTensor):
# meta tensor
meta = d[self.meta_key].meta # type: ignore
else:
# meta dict
meta = d[self.meta_key]

This might be needed to get around the type issue.

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.

Enhance ExtractDataKeyFromMetaKeyd to work with MetaTensor
2 participants