You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by jx...@apache.org on 2017/11/05 00:08:47 UTC

[incubator-mxnet] branch master updated: rename output layer of resnet (#8536)

This is an automated email from the ASF dual-hosted git repository.

jxie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new ba74540  rename output layer of resnet (#8536)
ba74540 is described below

commit ba745406ae482198469ed9f2fd52fb5d0ee5294b
Author: Sheng Zha <sz...@users.noreply.github.com>
AuthorDate: Sat Nov 4 17:08:44 2017 -0700

    rename output layer of resnet (#8536)
---
 python/mxnet/gluon/model_zoo/vision/resnet.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/python/mxnet/gluon/model_zoo/vision/resnet.py b/python/mxnet/gluon/model_zoo/vision/resnet.py
index f2c06c3..4474aee 100644
--- a/python/mxnet/gluon/model_zoo/vision/resnet.py
+++ b/python/mxnet/gluon/model_zoo/vision/resnet.py
@@ -320,13 +320,12 @@ class ResNetV2(HybridBlock):
                 self.features.add(self._make_layer(block, num_layer, channels[i+1],
                                                    stride, i+1, in_channels=in_channels))
                 in_channels = channels[i+1]
+            self.features.add(nn.BatchNorm())
+            self.features.add(nn.Activation('relu'))
+            self.features.add(nn.GlobalAvgPool2D())
+            self.features.add(nn.Flatten())
 
-            self.classifier = nn.HybridSequential(prefix='')
-            self.classifier.add(nn.BatchNorm())
-            self.classifier.add(nn.Activation('relu'))
-            self.classifier.add(nn.GlobalAvgPool2D())
-            self.classifier.add(nn.Flatten())
-            self.classifier.add(nn.Dense(classes, in_units=in_channels))
+            self.output = nn.Dense(classes, in_units=in_channels)
 
     def _make_layer(self, block, layers, channels, stride, stage_index, in_channels=0):
         layer = nn.HybridSequential(prefix='stage%d_'%stage_index)
@@ -339,7 +338,7 @@ class ResNetV2(HybridBlock):
 
     def hybrid_forward(self, F, x):
         x = self.features(x)
-        x = self.classifier(x)
+        x = self.output(x)
         return x
 
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].