Created by: zhhsplendid
Remove Read-Only Basic Type Variable in loop_vars
I didn't add test because these is an existing test case:
def while_loop_dyfunc_with_none(x):
i = fluid.dygraph.to_variable(x)\
if x is not None \
else fluid.dygraph.to_variable(x+1)
flag = 1
while x < 10:
i = i + x if flag is not None else x + i
x = x + 1
return i
As you can see, flag
is removed from loop_vars thus not converted into boolean tensor and the numerical test is still correct.
BTW, notice this PR doesn't add attribute into condition / write consideration because we found we are not handling class well now. I will put it as TODO thing.