Skip to content

Fix conv1d eager/graph mode inconsistency for zero-sized output#112639

Open
ayushozha wants to merge 1 commit intotensorflow:masterfrom
ayushozha:fix/conv1d-eager-validation
Open

Fix conv1d eager/graph mode inconsistency for zero-sized output#112639
ayushozha wants to merge 1 commit intotensorflow:masterfrom
ayushozha:fix/conv1d-eager-validation

Conversation

@ayushozha
Copy link
Copy Markdown

Summary

Test plan

  • Verify that tf.nn.conv1d(tf.zeros([1, 2, 1]), tf.zeros([5, 1, 1]), stride=1, padding='VALID') now raises ValueError in eager mode
  • Verify the same call under @tf.function still raises ValueError with a similar message
  • Verify that valid conv1d calls (kernel <= input) are unaffected
  • Verify that SAME padding is unaffected
  • Verify dilated convolutions that produce negative output also raise the error

🤖 Generated with Claude Code

@google-ml-butler google-ml-butler bot added the size:S CL Change Size: Small label Mar 18, 2026
@google-ml-butler google-ml-butler bot requested a review from cantonios March 18, 2026 08:22
@google-cla
Copy link
Copy Markdown

google-cla bot commented Mar 18, 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.

@google-ml-butler google-ml-butler bot added the awaiting review Pull request awaiting review label Mar 18, 2026
@ayushozha ayushozha force-pushed the fix/conv1d-eager-validation branch from d340e24 to 3e7e04f Compare March 18, 2026 09:46
…flow#112371)

Add validation in conv1d to raise ValueError when the output spatial
dimension would be negative with VALID padding. Previously, eager mode
silently produced a zero-sized tensor while graph mode raised an error.
Now both modes raise a consistent ValueError.
@ayushozha ayushozha force-pushed the fix/conv1d-eager-validation branch from 3e7e04f to d7f85f7 Compare March 18, 2026 22:30
@keerthanakadiri keerthanakadiri added the python Pull requests that update Python code label Mar 20, 2026
@github-project-automation github-project-automation bot moved this to Assigned Reviewer in PR Queue Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review Pull request awaiting review python Pull requests that update Python code size:S CL Change Size: Small

Projects

Status: Assigned Reviewer

Development

Successfully merging this pull request may close these issues.

Inconsistent behavior between tf.nn.conv1d eager execution and tf.function when output spatial dimension is zero

3 participants