NVIDIA / NVIDIA/apex

torch.index_add is broken

Open
#455 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

in both O1 and O2 opt levels, torch.index_add is broken.

RuntimeError: Expected object of scalar type Float but got scalar type Half for argument #4 'source' in call to _th_index_add_

in O1, the error can be fixed by adding index_add to FP32_FUNCS in amp/lists/torch_overrides.py.

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.

Research direction

Start in amp/lists/torch_overrides.py, where the issue identifies FP32_FUNCS and the O1 workaround. Reproduce torch.index_add at both O1 and O2 and inspect how each optimization level handles the operation. Done means the reported scalar-type error no longer occurs at either level.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.