diff --git a/python/paddle/fluid/dygraph/layers.py b/python/paddle/fluid/dygraph/layers.py index d564ac6e4a9714ebe28643c6f36a749e23f4824e..df64e645f386eb7b6591d28f4a66ce8a8f324cd9 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 ee37ffab2cb7521b83108a40febcfe88cab28633..9d2cbb4f03fdc807e1609f46eac44a0bb92af785 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