Closed
Description
This discussion is related to #3708.
Think of the running process of the following example derived from the design of IfOp, where the global block has two sub-blocks, one as the left branch of an IfElseOp, the other as the right branch.
import paddle as pd
x1 = var()
x2 = var()
c = pd.create_ifelseop_builder(inputs=[x1, x2], output_num=2)
with c.true_block() as b:
x1, x2 = b.inputs()
z = mul(x1, x2))
b.set_output(0, z)
b.set_output(1, add(x1, x2))
with c.false_block() as b:
x1, x2 = c1.inputs()
b.set_output(0, add(x1, x2))
b.set_output(1, mul(x1, x2))
cond = var()
out1, out2 = c(cond)
During the execution of above program, we want error as long as a line just executed refers to an undefined variable. For example, if we remove z = mul(x1, x2))
from above example, the execution of b.set_output(0, z)
must report an error about "undefined variable z".
Metadata
Metadata
Assignees
Labels
No labels