Skip to content

Remove features from Store properties#333

Merged
giovannivolpe merged 1 commit into
developfrom
bm/fix-store-properties
May 24, 2025
Merged

Remove features from Store properties#333
giovannivolpe merged 1 commit into
developfrom
bm/fix-store-properties

Conversation

@BenjaminMidtvedt
Copy link
Copy Markdown
Collaborator

Fixes an issue where feature was both set as a property of the Store class, as well as a attribute. With this PR, it is only an attribute.

This caused feature to be recalculated unecessarily, bypassing the memoization of the Store.

This change causes no changes in output (so no breaking change), but should significantly speed up pipelines using Store.

@giovannivolpe giovannivolpe self-assigned this May 24, 2025
@giovannivolpe giovannivolpe self-requested a review May 24, 2025 05:50
Comment thread deeptrack/features.py Outdated
Comment on lines +373 to +374
self._random_seed = DeepTrackNode(lambda: random.randint(0, 2147483648))
self._random_seed = DeepTrackNode(lambda: random.randint(0, 2147483648))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why there are two lines of code that seem to do the same?
Can we keep only one?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes! That's an unintentional change.

Comment thread deeptrack/features.py Outdated
Comment thread deeptrack/features.py
Defaults to `False`.
**kwargs:: dict of str to Any
Additional keyword arguments passed to the parent `Feature` class.

"""

super().__init__(feature=feature, key=key, replace=replace, **kwargs)
super().__init__(key=key, replace=replace, **kwargs)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The removal of feature=feature is the only "functional" change? or are there other changes?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That is the only one. I see that some more ones got added by accident by my auto-formatter. I'll make sure only this change comes through

@BenjaminMidtvedt BenjaminMidtvedt force-pushed the bm/fix-store-properties branch from 50ff0cd to a24ce66 Compare May 24, 2025 10:31
@giovannivolpe giovannivolpe merged commit 0d7e5fe into develop May 24, 2025
25 checks passed
@giovannivolpe giovannivolpe deleted the bm/fix-store-properties branch May 24, 2025 12:39
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