Created by: Aurelius84
support Tensor.shape in control_flow_if
Example code:
def foo(x):
batch_size = fluid.layers.shape(x)
if batch_size[0] > 16:
x = x + 1
return x
def foo(x):
if fluid.layers.shape(x)[0] > 16:
x = x + 1
return x
Currently, we can identify more cases that need to transform into layers.cond
. But now the case with and
/ or
is not supported and will be added in next PR.