Skip to content

Instantly share code, notes, and snippets.

@tuzhucheng
Last active October 25, 2017 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuzhucheng/27fff3b70747f7d9877659099e6226cc to your computer and use it in GitHub Desktop.
Save tuzhucheng/27fff3b70747f7d9877659099e6226cc to your computer and use it in GitHub Desktop.
Verbose output of ONNX export of SM Model for ranking short text pairs
In PyTorch there are 3 arguments used to call this model.
Arg 1: 1 x 50 x 20 FloatTensor
Arg 2: 1 x 50 x 19 FloatTensor
Arg 3: 1 x 4 FloatTensor
The first dimension is the batch size, the second dimension is the number of input channels to Conv1D. The last dimension for args 1 and 2 can vary depending on the sentence length.
graph(%1 : Float(1, 50, 20)
%2 : Float(1, 50, 19)
%3 : Float(1, 4)
%4 : Float(100, 50, 5)
%5 : Float(100)
%6 : Float(100, 50, 5)
%7 : Float(100)
%8 : Float(204, 204)
%9 : Float(204)
%10 : Float(2, 204)
%11 : Float(2)) {
%13 : UNKNOWN_TYPE = Conv[kernel_shape=[5], strides=[1, 1], pads=[0, 4, 0, 4], dilations=[1, 1], group=1](%1, %4), uses = [[%14.i0]];
%14 : Float(1, 100, 24) = Add[broadcast=1, axis=1](%13, %5), uses = [%15.i0];
%15 : Float(1, 100, 24) = Tanh(%14), uses = [%16.i0];
%16 : Float(1, 100, 1) = MaxPool[kernel_shape=[24], pads=[0], dilations=[1], strides=[24]](%15), uses = [%17.i0];
%17 : Float(1, 100) = Reshape[shape=[-1, 100]](%16), uses = [%24.i0];
%19 : UNKNOWN_TYPE = Conv[kernel_shape=[5], strides=[1, 1], pads=[0, 4, 0, 4], dilations=[1, 1], group=1](%2, %6), uses = [[%20.i0]];
%20 : Float(1, 100, 23) = Add[broadcast=1, axis=1](%19, %7), uses = [%21.i0];
%21 : Float(1, 100, 23) = Tanh(%20), uses = [%22.i0];
%22 : Float(1, 100, 1) = MaxPool[kernel_shape=[23], pads=[0], dilations=[1], strides=[23]](%21), uses = [%23.i0];
%23 : Float(1, 100) = Reshape[shape=[-1, 100]](%22), uses = [%24.i1];
%24 : Float(1, 204) = Concat[axis=1](%17, %23, %3), uses = [%26.i0];
%25 : Float(204!, 204!) = Transpose[perm=[1, 0]](%8), uses = [%26.i1];
%26 : Float(1, 204) = Gemm[alpha=1, beta=1, broadcast=1](%24, %25, %9), uses = [%27.i0];
%27 : Float(1, 204) = Tanh(%26), uses = [%28.i0];
%29 : Float(1, 204), %30 : UNKNOWN_TYPE = Dropout[ratio=0.5, is_test=1](%27), uses = [[%32.i0], []];
%31 : Float(204!, 2!) = Transpose[perm=[1, 0]](%10), uses = [%32.i1];
%32 : Float(1, 2) = Gemm[alpha=1, beta=1, broadcast=1](%29, %31, %11), uses = [%33.i0];
%33 : Float(1, 2) = Softmax(%32), uses = [%34.i0];
%34 : Float(1, 2) = Log(%33), uses = [%0.i0];
return (%34);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment