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

docs: clarify input arrays in device placement #919

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crusaderky
Copy link
Contributor

@crusaderky crusaderky commented Apr 1, 2025

Clarify how input arrays should be considered for device placement.
This new line is a repetition of bullet point 2, three lines above:

Preserve device assignment as much as possible (e.g. output arrays from a function are expected to be on the same device as input arrays to the function).

However, I am observing very high levels of ambiguity among the community on the interpretation of this paragraph, where I've had multiple people insist that the device set in the context manager or global default device should trump the device of input arrays. At which point, since all real-life backends always have a global default device, input-to-output device propagation would fly out of the window.

@rgommers
Copy link
Member

rgommers commented Apr 1, 2025

This change seems reasonable to me, it's more of a clarification than anything else. This numbered list was written with creation functions in mind I believe. The device= keyword descriptions already say something like "if device is None, use the device from the input array" in the relevant cases.

Before merging this, let's ensure the discussions in data-apis/array-api-compat#293 (and perhaps other places) have been settled to ensure it's all consistent.

@kgryte kgryte added this to the v2025 milestone Apr 2, 2025
@kgryte kgryte added the topic: Device Handling Device handling. label Apr 2, 2025
@kgryte kgryte changed the title Clarify input arrays in device placement docs: clarify input arrays in device placement Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: Device Handling Device handling.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants