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

Array: use np.result_type directly #787

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

matthiasdiener
Copy link
Contributor

@matthiasdiener matthiasdiener commented Oct 2, 2024

Similar to inducer/pytato#540

Please squash

@matthiasdiener
Copy link
Contributor Author

This probably needs a bit more testing, but what do you think of the idea @inducer?

Copy link
Owner

@inducer inducer left a comment

Choose a reason for hiding this comment

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

I'm generally in favor. The less of this duplicated nonsense logic we drag around, the better.


o1_key = obj1 if o1_is_integral and not o1_is_array else o1_dtype
o2_key = obj2 if o2_is_integral and not o2_is_array else o2_dtype
result = np.result_type(obj1, obj2)
Copy link
Owner

Choose a reason for hiding this comment

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

Add a comment (like the one in pytato) that we're passing pyopencl arrays to numpy, and that it doesn't seem to mind. Maybe add an analogous test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in 5f668e2

pyopencl/array.py Outdated Show resolved Hide resolved
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.

3 participants