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

Fix (u)int8 upcasting as per docs and numpy #650

Merged
merged 3 commits into from
Dec 11, 2023

Conversation

s-ol
Copy link
Contributor

@s-ol s-ol commented Dec 8, 2023

Close #649.

For testing with CircuitPython, see the branch https://github.com/s-ol/micropython-ulab/tree/fix-int8-upcasting.

Apologies if this breaks any tests that should have been updated, I couldn't get the test build to work on my system.

@s-ol s-ol changed the title Fix (u) int8 upcasting as per docs and numpy Fix (u)int8 upcasting as per docs and numpy Dec 8, 2023
@v923z
Copy link
Owner

v923z commented Dec 8, 2023

code/ndarray_operators.c Outdated Show resolved Hide resolved
} else if(rhs->dtype == NDARRAY_INT8) {
results = ndarray_new_dense_ndarray(ndim, shape, NDARRAY_INT16);
BINARY_LOOP(results, int16_t, uint8_t, int8_t, larray, lstrides, rarray, rstrides, *);
results = ndarray_new_dense_ndarray(ndim, shape, NDARRAY_INT8);
Copy link
Owner

Choose a reason for hiding this comment

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

Same here.

code/ndarray_operators.c Outdated Show resolved Hide resolved
code/ndarray_operators.c Outdated Show resolved Hide resolved
@s-ol s-ol force-pushed the mpy-fix-int8-upcasting branch from b095b3c to 889d87f Compare December 9, 2023 19:23
@v923z
Copy link
Owner

v923z commented Dec 10, 2023

I think this is OK now, thanks! Could you, please, increment the sub-minor version here

#define ULAB_VERSION 6.4.1
, and add an entry here https://github.com/v923z/micropython-ulab/blob/master/docs/ulab-change-log.md? You'll also have to fix the test https://github.com/v923z/micropython-ulab/actions/runs/7153101407/job/19492990488?pr=650, but I think that's just a single line in https://github.com/v923z/micropython-ulab/blob/master/tests/2d/numpy/operators.py.exp, here
array([5, 7, 9], dtype=uint16)
.

@s-ol s-ol force-pushed the mpy-fix-int8-upcasting branch from 889d87f to 17f82c2 Compare December 11, 2023 11:44
@v923z
Copy link
Owner

v923z commented Dec 11, 2023

OK, thanks!

@v923z v923z merged commit e329206 into v923z:master Dec 11, 2023
16 checks passed
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.

[BUG] Operations on uint8 don't respect upcasting rules
2 participants