"Invalid device_id argument supplied" -> typo

Open Beginner friendly
#723 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python

Research direction

Start at torch_directml/device.py line 38, where the invalid device_id exception is raised. Check the range wording against the zero-based device IDs and number of devices described in the issue. Done means the error message uses the correct inclusive upper-bound notation and value.

Written by the indexing model from the issue text.

Description

You know, if this would have been open source, then a quick PR would have fixed that...

  File "torch_directml\device.py", line 38, in device
    raise Exception(f"Invalid device_id argument supplied {device_id}. device_id must be in range [0, {num_devices}).")

So the fix seems to be something like:

-    raise Exception(f"Invalid device_id argument supplied {device_id}. device_id must be in range [0, {num_devices}).")
+    raise Exception(f"Invalid device_id argument supplied {device_id}. device_id must be in range [0, {num_devices - 1}].")

--> ] instead of ) and the number of devices is one-based, while the device-id is zero based.

Dominant language
C++
Stars
2.6k
Forks
338
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/DirectML

All issues in microsoft/DirectML

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.