From 9e4fac1ef42c572728e2645d506849ca1c166769 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Mon, 24 Jul 2017 16:12:28 +0800 Subject: [PATCH] Complete Add Op --- python/paddle/v2/framework/network.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python/paddle/v2/framework/network.py b/python/paddle/v2/framework/network.py index 347e7bb5ae7..bde48851a09 100644 --- a/python/paddle/v2/framework/network.py +++ b/python/paddle/v2/framework/network.py @@ -72,11 +72,21 @@ class Network(object): self.__complete_add_op__ = False def infer_shape(self): + self.complete_add_op() self.net.infer_shape(get_cur_scope()) + def run(self, device_context): + self.complete_add_op() + self.net.run(get_cur_scope(), device_context) + def __str__(self): return str(self.net) + def complete_add_op(self): + if not self.__complete_add_op__: + self.net.complete_add_op() + self.__complete_add_op__ = True + if __name__ == '__main__': net = Network() -- GitLab