Skip to content

Use output zero point for SPACE_TO_BATCH_ND int8 padding - #3973

Merged
veblush merged 1 commit into
tensorflow:mainfrom
sandeepvijayarao09:fix-space-to-batch-zero-point
Nov 5, 2026
Merged

veblush merged 1 commit into
tensorflow:mainfrom
sandeepvijayarao09:fix-space-to-batch-zero-point

Conversation

@sandeepvijayarao09

Copy link
Copy Markdown
Contributor

Description

SpaceToBatchNDPrepare never set SpaceToBatchParams::output_offset, so the reference kernel filled padded elements with 0 instead of the quantized value of real zero. For int8 tensors with a non-zero zero point (for example -128), the padded part of the output was wrong.

Prepare now sets output_offset to the output zero point for int8 and to 0 otherwise.

Added SpaceToBatchPaddingInt8NonZeroZeroPoint, a padded int8 case with zero point -128, which fails before this change.

BUG=#3952

🤖 Generated with Claude Code

@sandeepvijayarao09
sandeepvijayarao09 requested a review from a team as a code owner November 5, 2026 05:03
@veblush veblush added the ci:full Triggers the comprehensive cross-platform test suite. label Nov 5, 2026
@veblush
veblush temporarily deployed to integration-test November 5, 2026 18:13 — with GitHub Actions Inactive
SpaceToBatchNDPrepare never set SpaceToBatchParams::output_offset, so the
reference kernel filled padded elements with 0 instead of the quantized
value of real zero. For int8 tensors with a non-zero zero point (e.g. -128)
the padded output was wrong.

Set output_offset to the output zero point for int8 in Prepare, and add a
padding test with zero point -128 that fails before this change.

BUG=#3952
@veblush
veblush force-pushed the fix-space-to-batch-zero-point branch from 5c5ef45 to d5331aa Compare November 5, 2026 19:11
@veblush
veblush temporarily deployed to integration-test November 5, 2026 19:12 — with GitHub Actions Inactive
@ddavis-2015 ddavis-2015 added the type:bug Something isn't working as intended. label Nov 5, 2026
@ddavis-2015 ddavis-2015 added ci:full Triggers the comprehensive cross-platform test suite. and removed ci:full Triggers the comprehensive cross-platform test suite. labels Nov 5, 2026
@ddavis-2015
ddavis-2015 requested a review from veblush November 5, 2026 22:19

@veblush veblush left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

@veblush
veblush added this pull request to the merge queue Nov 5, 2026
Merged via the queue into tensorflow:main with commit f157c0d Nov 5, 2026
93 checks passed

This branch was previously deployed

1 inactive deployment
integration-test — d5331aae Deployed Nov 5, 2026 by ddavis-2015 via approval-gate #1335
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Triggers the comprehensive cross-platform test suite. type:bug Something isn't working as intended.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants