From 3bdbb94f42a8ebb3f1f6f709a8025aa87dd92bfc Mon Sep 17 00:00:00 2001 From: minqiyang Date: Tue, 16 Apr 2019 15:58:12 +0800 Subject: [PATCH] Fix train mode problem test=release/1.4 --- python/paddle/fluid/dygraph/layers.py | 8 ++++---- python/paddle/fluid/dygraph/tracer.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/paddle/fluid/dygraph/layers.py b/python/paddle/fluid/dygraph/layers.py index d564ac6e4a..df64e645f3 100644 --- a/python/paddle/fluid/dygraph/layers.py +++ b/python/paddle/fluid/dygraph/layers.py @@ -49,10 +49,10 @@ class Layer(core.Layer): self._helper = LayerObjectHelper(self._full_name) def train(self): - framework._dygraph_tracer()._train_mode() + framework._dygraph_tracer().train_mode() def eval(self): - framework._dygraph_tracer()._eval_mode() + framework._dygraph_tracer().eval_mode() def full_name(self): """Full name for this layers. @@ -261,10 +261,10 @@ class PyLayer(core.PyLayer): super(PyLayer, self).__init__() def train(self): - framework._dygraph_tracer()._train_mode() + framework._dygraph_tracer().train_mode() def eval(self): - framework._dygraph_tracer()._eval_mode() + framework._dygraph_tracer().eval_mode() @classmethod def _do_forward(cls, inputs): diff --git a/python/paddle/fluid/dygraph/tracer.py b/python/paddle/fluid/dygraph/tracer.py index ee37ffab2c..9d2cbb4f03 100644 --- a/python/paddle/fluid/dygraph/tracer.py +++ b/python/paddle/fluid/dygraph/tracer.py @@ -118,8 +118,8 @@ class Tracer(core.Tracer): if k in backward_refs: op.backward_refs[k] = outputs[k] - def _train_mode(self): + def train_mode(self): self._train_mode = True - def _eval_mode(self): + def eval_mode(self): self._train_mode = False -- GitLab