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

performance: Edge initialization #458

Merged
merged 2 commits into from
Sep 5, 2023

Conversation

nkemnitz
Copy link
Contributor

@nkemnitz nkemnitz commented Sep 3, 2023

Proposed changes:

  • only set self._affinities and self._areas if they are not provided
  • np.array( will only create copies if necessary (e.g. because the data type is not what it should be)

The second one might be a bit risky? Depending on what the original, intended behavior was: the default behavior for np.array in __init__ is to always create a copy, but the current setters are only updating the reference

@nkemnitz nkemnitz requested a review from akhileshh September 3, 2023 21:15
Copy link
Contributor

@akhileshh akhileshh left a comment

Choose a reason for hiding this comment

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

Wasn't aware of the numpy.array's copy argument, thanks!

@akhileshh akhileshh merged commit 6484f41 into CAVEconnectome:main Sep 5, 2023
@nkemnitz
Copy link
Contributor Author

nkemnitz commented Sep 6, 2023

Oh, there is also np.asarray which does the same and avoids copies by default

@nkemnitz nkemnitz deleted the zetta-avoid-copy branch September 6, 2023 08:27
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