未验证 提交 9556c688 编写于 作者: C Charles-hit 提交者: GitHub

fix some auto code generation bugs (#45232)

* 修复生成动态图代码时,如果输出没有配置名字,会导致下标越界的问题。

* decide forward_return[0] is not none

* 修改反向yaml前向输出只有一个时,未配置名字,那么输出自动生成为out

* modify code style
上级 adaffb7b
......@@ -446,7 +446,13 @@ class FunctionGeneratorBase:
for i in range(len(forward_returns_list)):
forward_return = forward_returns_list[i]
return_name = forward_return[0]
if len(forward_return[0]) == 0:
if (len(forward_returns_list) == 1):
return_name = "out"
else:
return_name = "out_{}".format(i + 1)
else:
return_name = forward_return[0]
return_type = forward_return[1]
return_pos = forward_return[2]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册