Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement cast support for ubyte and half#145

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ngoldbaum merged 4 commits intonumpy:mainfromjuntyr:astype
Sep 9, 2025

Conversation

@juntyr
Copy link
Contributor

@juntyrjuntyr commentedSep 7, 2025
edited
Loading

Fixes#144

@juntyr
Copy link
ContributorAuthor

@SwayamInSync Does the version of C++ we use already have float16 support / what does numpy use so that I could also add casting support for float16?

@ngoldbaum
Copy link
Member

Here's where it happens in the stringdtype prototype:

STRING_TO_FLOAT_RESOLVE_DESCRIPTORS(float16,HALF)

You need to link against libnpymath to get the necessary C API:

https://numpy.org/doc/stable/reference/c-api/coremath.html#half-precision-functions

Here's where I handled that in the meson config:

npymath_path= incdir_numpy/'..'/'lib'

@juntyr
Copy link
ContributorAuthor

The other problem, and probably why ubyte wasn't added earlier, is that ubyte and bool alias but need different code paths. Not sure how to fix that ...

@juntyrjuntyr changed the titleImplement cast support for ubyteImplement cast support for ubyte and halfSep 8, 2025
@juntyr
Copy link
ContributorAuthor

@SwayamInSync@ngoldbaum I think everything should work now, what do you think?

Copy link
Member

@SwayamInSyncSwayamInSync left a comment

Choose a reason for hiding this comment

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

LGTM

Implement cast support for ubyteUse template magic to distinguish npy_bool and npy_halfImplement cast support for half
@ngoldbaum
Copy link
Member

Thanks for doing this@juntyr!

@ngoldbaumngoldbaum merged commit77d4406 intonumpy:mainSep 9, 2025
7 checks passed
@SwayamInSync
Copy link
Member

BTW if needed then in thisSwayamInSync#13 I wrote the workaround to get an "Non-Implemented" error instead of segfault crash.

@ngoldbaum
Copy link
Member

Ah, I missed that - can you send it in as a followup PR?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@SwayamInSyncSwayamInSyncSwayamInSync approved these changes

@ngoldbaumngoldbaumngoldbaum approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

v1.0

Development

Successfully merging this pull request may close these issues.

QuadDtype is missing casts for np.uint8 and np.float16

3 participants

@juntyr@ngoldbaum@SwayamInSync

[8]ページ先頭

©2009-2025 Movatter.jp