Skip to content

[wasm] Fix gather operation bug when using batches#8659

Open
unexploredtest wants to merge 2 commits intotensorflow:masterfrom
unexploredtest:master
Open

[wasm] Fix gather operation bug when using batches#8659
unexploredtest wants to merge 2 commits intotensorflow:masterfrom
unexploredtest:master

Conversation

@unexploredtest
Copy link
Copy Markdown

Fixes #8658
Basically the shape of indices is [batchSize, indicesSize / shapeInfo.batchSize], so in order to move to the next batch we have to increment by indicesSize / shapeInfo.batchSize not shapeInfo.batchSize as this code is doing:

loc[2] = indices_ptr[batch_loc * batch_size + indices_loc];

So we simply pass indicesSize / shapeInfo.batchSize instead of shapeInfo.batchSize which is named indicesPerBatch. If the name or coding style is undesired let me know.
Also I wanted to add tests, but I realized there were no units for this kernel... Shall I add one anyways?

@google-cla
Copy link
Copy Markdown

google-cla bot commented Mar 31, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wasm: Gather function produces wrong results when using batches.

1 participant