apple / apple/coremltools

Implicit broadcasting

Open
#1,686 9 comments 0 reactions 0 assignees View on GitHub
bug PyTorch (traced) triaged
Dominant language
Python
Stars
5.4k
Forks
850
Avg merge
4d 5h
Merged PRs (30d)
10

Description

I'm facing errors when using implicit broadcasting like x[...,-1] = x[...,-1] + 5

Strangely, it sometimes works when run independently but fails if I then feed x into another op like y = gather(x,-1,indices)

I also face this issue with simpler cases like x[...,0] = 5.0

I was wondering if this is explicit behavior and if there's any standard examples or solutions. Do I just need to use torch.repeat explicitly? The issue is that my code already has many of these ops so replacing each manually would take sometime. And the torch trace works just fine.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the implicit-broadcasting assignments x[...,-1] = x[...,-1] + 5 and x[...,0] = 5.0, then feed the result to gather(x,-1,indices) and compare that with an independently run operation and torch trace. Done means establishing whether these cases are supported and identifying the relevant conversion behavior or documenting the required handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.