Skip to content

RFC Add gallery example with Array API support #32886

Closed as duplicate
Closed as duplicate

Description

@lesteve

Mentioned somewhere in the release activity the closest I could find was #32809 (comment). It would probably be doable to add pytorch-cpu in the doc lock-file and add an example with a somewhat non trivial pipeline.

One idea could be to have some commented code saying device = 'cuda' and explain that uncommenting it will run on GPU if you have one.

Questions:

  • not sure which version to pick for doc-min-dependencies build, I think it doesn't really matter and convenience (for us as maintainers) is the main thing here, since array API is still experimental
  • some other things I did not think of ...

Activity

  1. added
    Needs Triage
    on Dec 11, 2025
  2. added and removed
    Needs Triage
    on Dec 11, 2025
  3. moved this to Todo in Array APIon Dec 11, 2025
  4. ogrisel commented on Dec 12, 2025

    @ogrisel
    Member

    We can even write code that detects the presence of cuda or mps GPUs and falls back to CPU otherwise.

    if torch.cuda.is_available():
        device_name = "cuda"
    elif torch.backends.mps.is_available():
        device_name = "mps"
    else:
        device_name = "cpu"
    
    print(f"Using device: {device_name}")
    device = torch.device(device_name)
  5. ogrisel commented on Nov 17, 2026

    @ogrisel
    Member

    I think we can close in favor of #35420 which has more details.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions