提交 5eed0134 编写于 作者: D Dong Zhihong

"refix the python logic"

上级 5bd14f6e
...@@ -20,10 +20,10 @@ class Variable(object): ...@@ -20,10 +20,10 @@ class Variable(object):
if name is None: if name is None:
name = Variable._unique_var_name_() name = Variable._unique_var_name_()
try: is_new_var = False
self.desc = self.block.desc.find_var(name) self.desc = self.block.desc.find_var(name)
is_new_var = False
except core.EnforceNotMet: if self.desc is None:
self.desc = self.block.desc.var(name) self.desc = self.block.desc.var(name)
is_new_var = True is_new_var = True
......
...@@ -51,7 +51,7 @@ class TestProgram(unittest.TestCase): ...@@ -51,7 +51,7 @@ class TestProgram(unittest.TestCase):
sum_op_desc.set_input("Y", ["b1"]) sum_op_desc.set_input("Y", ["b1"])
sum_op_desc.set_output("Out", ["out2"]) sum_op_desc.set_output("Out", ["out2"])
target = block.new_var("out2") target = block.var("out2")
expect_ops = [ expect_ops = [
"mul", "elementwise_add", "fill_constant", "elementwise_add_grad", "mul", "elementwise_add", "fill_constant", "elementwise_add_grad",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册