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

[FEATURE REQUEST] Support for keepdims? #697

Open
kwagyeman opened this issue Nov 26, 2024 · 4 comments
Open

[FEATURE REQUEST] Support for keepdims? #697

kwagyeman opened this issue Nov 26, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@kwagyeman
Copy link

For processing things like yolo in ulab the vector size could be 1:N. In the case of 1 we need support for keepdims to prevent dimensionality reduction from happening: https://github.com/openmv/openmv/pull/2521/files

@v923z
Copy link
Owner

v923z commented Nov 26, 2024

There are other instances, where keeping the dimension would be useful. It shouldn't be too hard, I simply didn't have time to implement it.

@kwagyeman
Copy link
Author

kwagyeman commented Nov 26, 2024

Looks like you could just add it as an arg here and handle the return of a scalar from each case and turn that scalar back into an array: https://github.com/v923z/micropython-ulab/blob/master/code/numpy/numerical.c. Probably also need to do the same in a few other places.

@v923z
Copy link
Owner

v923z commented Nov 26, 2024

That would cover the case, when the return value is a scalar, but you might also want to keep the dimension, when the tensor is contracted. So, it's a bit more involving. I'll take a stab at it over the weekend.

@kwagyeman
Copy link
Author

Thank you! Yes, handling this otherwise gets quite ugly quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants