未验证 提交 a01113c3 编写于 作者: L LielinJiang 提交者: GitHub

Add relu layer for lenet (#24874)

* add relu for lenet, test=develop

* fix test model, test=develop
上级 3b28629e
......@@ -23,8 +23,7 @@ import shutil
import tempfile
from paddle import fluid
from paddle.fluid.dygraph.nn import Conv2D, Pool2D, Linear
from paddle.fluid.dygraph.container import Sequential
from paddle.nn import Conv2D, Pool2D, Linear, ReLU, Sequential
from paddle.fluid.dygraph.base import to_variable
from paddle.incubate.hapi.model import Model, Input, set_device
......@@ -42,9 +41,11 @@ class LeNetDygraph(fluid.dygraph.Layer):
self.features = Sequential(
Conv2D(
1, 6, 3, stride=1, padding=1),
ReLU(),
Pool2D(2, 'max', 2),
Conv2D(
6, 16, 5, stride=1, padding=0),
ReLU(),
Pool2D(2, 'max', 2))
if num_classes > 0:
......
......@@ -13,8 +13,7 @@
#limitations under the License.
import paddle.fluid as fluid
from paddle.fluid.dygraph.nn import Conv2D, BatchNorm, Pool2D, Linear
from paddle.fluid.dygraph.container import Sequential
from paddle.nn import Conv2D, Pool2D, Linear, ReLU, Sequential
from ...model import Model
......@@ -44,9 +43,11 @@ class LeNet(Model):
self.features = Sequential(
Conv2D(
1, 6, 3, stride=1, padding=1),
ReLU(),
Pool2D(2, 'max', 2),
Conv2D(
6, 16, 5, stride=1, padding=0),
ReLU(),
Pool2D(2, 'max', 2))
if num_classes > 0:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册