Skip to content

Commit

Permalink
Add embedding to print_summary (apache#12796)
Browse files Browse the repository at this point in the history
  • Loading branch information
soeque1 authored and piyushghai committed Nov 8, 2018
1 parent a97054e commit 6666954
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions python/mxnet/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions tests/python/unittest/test_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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():
Expand Down

0 comments on commit 6666954

Please # to comment.