Skip to content

Validate values sequence input in tf.stack (fix #125374) - #125386

Open
SparshGarg999 wants to merge 1 commit into
tensorflow:masterfrom
SparshGarg999:fix-tf-stack-single-tensor-validation-125374
Open

Validate values sequence input in tf.stack (fix #125374)#125386
SparshGarg999 wants to merge 1 commit into
tensorflow:masterfrom
SparshGarg999:fix-tf-stack-single-tensor-validation-125374

Conversation

@SparshGarg999

@SparshGarg999 SparshGarg999 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #125374

Context & Problem

tf.stack documents its values parameter as a sequence of tensors. When passed a single Tensor object directly instead of a sequence, eager mode silently passed the input tensor through unchanged (no stacking performed), whereas XLA compilation (jit_compile=True) raised a TypeError from the underlying Pack op.

Solution & Changes

  • Added an explicit sequence validation check to tf.stack in tensorflow/python/ops/array_ops.py to ensure consistent TypeError exceptions are raised across eager, graph, and XLA execution modes when values is not a list or tuple of tensors.

Testing & Verification

  • Tested tf.stack input validation with single tensor vs sequence inputs under eager execution and XLA (jit_compile=True).

@google-ml-butler google-ml-butler Bot added the size:XL CL Change Size:Extra Large label Aug 15, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@google-ml-butler
google-ml-butler Bot requested a review from cantonios August 15, 2026 03:11
@google-ml-butler google-ml-butler Bot added the awaiting review Pull request awaiting review label Aug 15, 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 size:XL CL Change Size:Extra Large

Projects

None yet

2 participants