Skip to content

get_available_devices() #1643

@alexewerlof

Description

@alexewerlof

Feature request

Add a function to get all the possible valid values of device in a given environment (e.g. node, electron, browser).

Motivation

We have ModelRegistery.get_available_dtypes() which is a huge help in user onboarding:

  • Instead of guessing the best dtype for a given machine, we can let the users choose.
  • We can try different values and see which one works (fallback mechanism).

But when it comes to device, we're left with guessing.

  • auto has its own problems (types in example #1624)
  • Without a list, the code for trying fallbacks relies on hard coded strings

The value is available as suportedDevices in onnx.js but not exposed externally.

Your contribution

I could implement a PR if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions