juliusshufan closed pull request #9305: Fixing two symbol files for CNN
URL: https://github.com/apache/incubator-mxnet/pull/9305
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/example/image-classification/symbols/googlenet.py 
b/example/image-classification/symbols/googlenet.py
index 05f33da5d8..4ed736a573 100644
--- a/example/image-classification/symbols/googlenet.py
+++ b/example/image-classification/symbols/googlenet.py
@@ -65,7 +65,7 @@ def get_symbol(num_classes = 1000, **kwargs):
     pool5 = mx.sym.Pooling(in4e, kernel=(3, 3), stride=(2, 2), pool_type="max")
     in5a = InceptionFactory(pool5, 256, 160, 320, 32, 128, "max", 128, 
name="in5a")
     in5b = InceptionFactory(in5a, 384, 192, 384, 48, 128, "max", 128, 
name="in5b")
-    pool6 = mx.sym.Pooling(in5b, kernel=(7, 7), stride=(1,1), pool_type="avg")
+    pool6 = mx.sym.Pooling(in5b, kernel=(7, 7), stride=(1,1), pad=(1, 1), 
pool_type="avg")
     flatten = mx.sym.Flatten(data=pool6)
     fc1 = mx.sym.FullyConnected(data=flatten, num_hidden=num_classes)
     softmax = mx.symbol.SoftmaxOutput(data=fc1, name='softmax')
diff --git a/example/image-classification/symbols/vgg.py 
b/example/image-classification/symbols/vgg.py
index 8ae48a0a28..264dd6c8e8 100644
--- a/example/image-classification/symbols/vgg.py
+++ b/example/image-classification/symbols/vgg.py
@@ -62,8 +62,12 @@ def get_symbol(num_classes, num_layers=11, batch_norm=False, 
dtype='float32', **
                 13: ([2, 2, 2, 2, 2], [64, 128, 256, 512, 512]),
                 16: ([2, 2, 3, 3, 3], [64, 128, 256, 512, 512]),
                 19: ([2, 2, 4, 4, 4], [64, 128, 256, 512, 512])}
-    if not vgg_spec.has_key(num_layers):
-        raise ValueError("Invalide num_layers {}. Possible choices are 
11,13,16,19.".format(num_layers))
+    if sys.version_info > (3,):
+        if not num_layers in vgg_spec:
+            raise ValueError("Invalide num_layers {}. Possible choices are 
11,13,16,19.".format(num_layers))
+    else:
+        if not vgg_spec.has_key(num_layers):
+            raise ValueError("Invalide num_layers {}. Possible choices are 
11,13,16,19.".format(num_layers))
     layers, filters = vgg_spec[num_layers]
     data = mx.sym.Variable(name="data")
     if dtype == 'float16':


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to