mlx icon indicating copy to clipboard operation
mlx copied to clipboard

Return zero VJPs for scatter indices

Open devin-lai opened this issue 6 months ago • 0 comments

Summary

  • Return zero VJPs for scatter and scatter_axis index inputs.
  • Match gather behavior and fix gradients when scatter indices come from differentiable values.
  • Add autograd coverage for direct and derived scatter indices.

Closes #1439.

Tests

  • /opt/homebrew/bin/black --check python/tests/test_autograd.py
  • clang-format --dry-run --Werror mlx/primitives.cpp
  • git diff --check
  • PYTHONPATH=/Users/ldy/Desktop/project/mt/opencode/mlx/python:/Users/ldy/Desktop/project/mt/opencode/mlx/python/tests python3.11 -m unittest python.tests.test_autograd.TestAutograd.test_scatter_index_vjp
  • PYTHONPATH=/Users/ldy/Desktop/project/mt/opencode/mlx/python:/Users/ldy/Desktop/project/mt/opencode/mlx/python/tests python3.11 -m unittest python.tests.test_autograd

devin-lai avatar Jun 01 '26 12:06 devin-lai