未验证 提交 7a96b6d1 编写于 作者: L littletomatodonkey 提交者: GitHub

adapt to net.eval for the framework just contains training flag setting (#711)

上级 2a41727d
...@@ -47,6 +47,12 @@ class Net(paddle.nn.Layer): ...@@ -47,6 +47,12 @@ class Net(paddle.nn.Layer):
self.pre_net = net(class_dim=class_dim) self.pre_net = net(class_dim=class_dim)
self.model = model self.model = model
def eval(self):
self.training = False
for layer in self.sublayers():
layer.training = False
layer.eval()
def forward(self, inputs): def forward(self, inputs):
x = self.pre_net(inputs) x = self.pre_net(inputs)
if self.model == "GoogLeNet": if self.model == "GoogLeNet":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册