Skip to content

FIX Use array's device when promoting scalars - #73

Merged
asmeurer merged 1 commit into
data-apis:mainfrom
betatim:inherit-device-scalar-promotion
Oct 21, 2024
Merged

asmeurer merged 1 commit into
data-apis:mainfrom
betatim:inherit-device-scalar-promotion

Conversation

@betatim

@betatim betatim commented Oct 21, 2024

Copy link
Copy Markdown
Member

When promoting a scalar in the context of an existing array, e.g. x ** 2 we should use the device of x for the array we create.

device1 = Device("device1")
x = asarray([1., 2, 3], device=device1)

y = x ** 2

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Without the change this line would fail, but I felt like having the assert below is somehow useful for readers from the future, even though it isn't strictly necessary

@asmeurer

Copy link
Copy Markdown
Member

@betatim should I make a release with these changes or are there more incoming?

@betatim

betatim commented Oct 22, 2024

Copy link
Copy Markdown
Member Author

I don't know, maybe lets wait a bit. I've been finding these via running the scikit-learn tests, so far they don't run to completion. But it needs a bit of digging to figure out what the bug is each time

@betatim
betatim deleted the inherit-device-scalar-promotion branch October 22, 2024 07:08
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