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

add meta transform #411

Merged
merged 1 commit into from
Aug 7, 2024
Merged

add meta transform #411

merged 1 commit into from
Aug 7, 2024

Conversation

benjijamorris
Copy link
Contributor

What does this PR do?

  • add transform that adds metadata keys to attributes of a metatensor

Before submitting

  • Did you make sure title is self-explanatory and the description concisely explains the PR?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you test your PR locally with pytest command?
  • Did you run pre-commit hooks with pre-commit run -a command?

Did you have fun?

Make sure you had fun coding 🙃

raise ValueError(
f"Image key {self.image_key} must be a MetaTensor, got {type(data[self.image_key])}"
)
new_meta = {k: data[k] for k in self.meta_keys}
Copy link
Member

Choose a reason for hiding this comment

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

just want to check that this is not data[self.image_key].meta[k]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct, the idea is if we have data like {img: MetaTensor(), meta_key1: blah, meta_key2: bloo}, we want to add meta_key1 and meta_key2 to the img MetaTensor

@benjijamorris benjijamorris merged commit 8e05a63 into main Aug 7, 2024
4 of 6 checks passed
@benjijamorris benjijamorris deleted the feature/metadata_transform branch August 7, 2024 22:24
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