Skip to content

fix: support dynamic slice_scatter fallback shapes - #4455

Open
kiwigitops wants to merge 1 commit into
pytorch:mainfrom
kiwigitops:fix/dynamic-slice-scatter-indices
Open

fix: support dynamic slice_scatter fallback shapes#4455
kiwigitops wants to merge 1 commit into
pytorch:mainfrom
kiwigitops:fix/dynamic-slice-scatter-indices

Conversation

@kiwigitops

Copy link
Copy Markdown

Description

The slice_scatter fallback now expands its index tensor inside TensorRT when the source has dynamic dimensions. Static sources continue to use the existing NumPy broadcast path.

The fallback previously passed src.shape directly to np.broadcast_to. TensorRT represents dynamic dimensions as -1, which caused NumPy to raise before the network could be built.

A converter regression test covers a stepped slice_scatter with dynamic batch and feature dimensions.

Fixes #4437

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Validation

  • Repository pre-commit hooks on both changed files (including isort, mypy, ruff, black, and typos)
  • Python bytecode compilation for both changed files
  • CUDA/TensorRT converter test was not run locally because this machine does not have CUDA or TensorRT

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added a regression test for the fix

@meta-cla meta-cla Bot added the cla signed label Aug 1, 2026
@github-actions github-actions Bot added component: tests Issues re: Tests component: conversion Issues re: Conversion stage component: core Issues re: The core compiler component: converters Issues re: Specific op converters component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Aug 1, 2026
@github-actions
github-actions Bot requested a review from apbose August 1, 2026 01:34
@kiwigitops
kiwigitops marked this pull request as ready for review August 1, 2026 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed component: api [Python] Issues re: Python API component: conversion Issues re: Conversion stage component: converters Issues re: Specific op converters component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: tests Issues re: Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Bug] slice_scatter: ValueError: all elements of broadcast shape must be non-negative

1 participant