未验证 提交 5413fd79 编写于 作者: A Aurelius84 提交者: GitHub

[Dy2Stat]Make convert_shape return List type (#43302)

上级 0ffaf049
...@@ -320,7 +320,7 @@ def convert_var_shape(x, idx=None, in_control_flow=False): ...@@ -320,7 +320,7 @@ def convert_var_shape(x, idx=None, in_control_flow=False):
or has_negative(x.shape, idx)): or has_negative(x.shape, idx)):
return nn.shape(x) if idx is None else nn.shape(x)[idx] return nn.shape(x) if idx is None else nn.shape(x)[idx]
else: else:
return x.shape if idx is None else x.shape[idx] return list(x.shape) if idx is None else x.shape[idx]
def convert_var_shape_simple(x): def convert_var_shape_simple(x):
...@@ -330,7 +330,8 @@ def convert_var_shape_simple(x): ...@@ -330,7 +330,8 @@ def convert_var_shape_simple(x):
if isinstance(x, Variable): if isinstance(x, Variable):
return nn.shape(x) return nn.shape(x)
else: else:
return x.shape # Use list() to make returned type consistant with dygraph
return list(x.shape)
def eval_if_exist_else_none(name, global_symbol_table): def eval_if_exist_else_none(name, global_symbol_table):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册