diff --git a/python/paddle/v2/framework/framework.py b/python/paddle/v2/framework/framework.py index 9c032400a1b4dbcd4cc188ee885b1fa7d04b020a..a24c78171e07249beeb8131d2d338b01c30e5c1f 100644 --- a/python/paddle/v2/framework/framework.py +++ b/python/paddle/v2/framework/framework.py @@ -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() diff --git a/python/paddle/v2/framework/tests/test_program.py b/python/paddle/v2/framework/tests/test_program.py index 8d8dd4689885ac8a8f93a7275c554a6e3678979a..c55dd8de7282d4c941777054ad9d6437c87f0bc6 100644 --- a/python/paddle/v2/framework/tests/test_program.py +++ b/python/paddle/v2/framework/tests/test_program.py @@ -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(