提交 d253df74 编写于 作者: Q Qiao Longfei 提交者: GitHub

remove Program.instance (#4915)

* remove Program.instance

* fix test_program.py
上级 47f773dd
......@@ -399,14 +399,6 @@ class Block(object):
class Program(object):
@classmethod
def instance(cls):
# From https://stackoverflow.com/questions/8212053
# Making Program as a Singleton class.
if not hasattr(cls, '_instance'):
cls._instance = cls()
return cls._instance
def __init__(self):
self.desc = core.ProgramDesc()
self.blocks = [Block(self, 0)]
......@@ -500,4 +492,4 @@ class Parameter(Variable):
# program is a global instance.
g_program = Program.instance()
g_program = Program()
......@@ -53,7 +53,7 @@ class TestProgram(unittest.TestCase):
print prog.clone()
def test_append_backward(self):
prog = Program.instance()
prog = Program()
block = prog.global_block()
mul_x = block.create_var(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册