Commit 1c481014 authored by Skye Wanderman-Milne's avatar Skye Wanderman-Milne Committed by TensorFlower Gardener
Browse files

Hoist function input placeholders out of any control flow context.

Prior to this change, functions that closed over external tensors in a
while loop would cause a segfault at runtime. This is because the
external tensors are temporarily represented as placeholders in the
function body before being replaced by input parameters, and the
placeholders would be created directly in the while loop body. This
would eventually lead to using the input tensor in the while loop body
without an enter node. This wasn't caught by the runtime check because
it isn't applied to function bodies.

This change adds tests for capturing tensors in a while loop body and
in a cond context. Note that the cond test passed without this fix.

PiperOrigin-RevId: 177464541
parent 976049bb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment