You need to sign in or sign up before continuing.
Created by: Aurelius84
while usingwhile_loop
in static graph, if python mutable object like dict/list/set
is involved in loop_vars
, the object (or var) shall not add or delete element in body function
.
In this PR, we add assert_same_structure
to check output_vars.
If a list var add a element in body function
, it will raise ValueError as follows:
ValueError: body in while_loop should return the same arity (length and structure) and types as loop_vars: The two structures don't have the same number of elements.
First structure (3 elements): (name: "fill_constant_0.tmp_0"
type {
type: LOD_TENSOR
lod_tensor {
tensor {
data_type: INT64
dims: 1
......
Second structure (2 elements): [name: "fill_constant_0.tmp_0"
type {
type: LOD_TENSOR
lod_tensor {
tensor {
data_type: INT64
dims: 1
......
Assertion failed
Process finished with exit code 1