You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/10/16 19:39:07 UTC

[GitHub] sandeep-krishnamurthy closed pull request #12796: Add embedding to print_summary

sandeep-krishnamurthy closed pull request #12796: Add embedding to print_summary
URL: https://github.com/apache/incubator-mxnet/pull/12796
 
 
   

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/python/mxnet/visualization.py b/python/mxnet/visualization.py
index 82946204847..a0eb253cc7e 100644
--- a/python/mxnet/visualization.py
+++ b/python/mxnet/visualization.py
@@ -157,6 +157,8 @@ def print_layer_summary(node, out_shape):
             if show_shape:
                 num_filter = shape_dict[key][1]
                 cur_param = int(num_filter) * 2
+        elif op == 'Embedding':
+            cur_param = int(node["attrs"]['input_dim']) * int(node["attrs"]['output_dim'])
         if not pre_node:
             first_connection = ''
         else:
diff --git a/tests/python/unittest/test_viz.py b/tests/python/unittest/test_viz.py
index eb5921f2e82..fe564b0088f 100644
--- a/tests/python/unittest/test_viz.py
+++ b/tests/python/unittest/test_viz.py
@@ -24,7 +24,8 @@
 def test_print_summary():
     data = mx.sym.Variable('data')
     bias = mx.sym.Variable('fc1_bias', lr_mult=1.0)
-    conv1= mx.symbol.Convolution(data = data, name='conv1', num_filter=32, kernel=(3,3), stride=(2,2))
+    emb1= mx.symbol.Embedding(data = data, name='emb1', input_dim=100, output_dim=28)
+    conv1= mx.symbol.Convolution(data = emb1, name='conv1', num_filter=32, kernel=(3,3), stride=(2,2))
     bn1 = mx.symbol.BatchNorm(data = conv1, name="bn1")
     act1 = mx.symbol.Activation(data = bn1, name='relu1', act_type="relu")
     mp1 = mx.symbol.Pooling(data = act1, name = 'mp1', kernel=(2,2), stride=(2,2), pool_type='max')
@@ -33,7 +34,7 @@ def test_print_summary():
     sc1 = mx.symbol.SliceChannel(data=fc2, num_outputs=10, name="slice_1", squeeze_axis=0)
     mx.viz.print_summary(sc1)
     shape = {}
-    shape["data"]=(1,3,28,28)
+    shape["data"]=(1,3,28)
     mx.viz.print_summary(sc1, shape)
 
 def graphviz_exists():


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services