Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Add embedding to print_summary #12796

Merged
merged 1 commit into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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