Skip to content

Commit

Permalink
Identityがexperimentalじゃなくなったので正式に対応
Browse files Browse the repository at this point in the history
  • Loading branch information
Masato Hori committed May 7, 2018
1 parent 72e48b7 commit 60b9166
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
8 changes: 1 addition & 7 deletions python/src/nnabla/utils/converter/onnx/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"Greater": "Greater",
"Equal": "Equal",
"Exp": "Exp",
"Identity": "Identity",
# optype with different names
"ReLU": "Relu",
"LeakyReLU": "LeakyRelu",
Expand All @@ -61,7 +62,6 @@
"Maximum2": "Max",
"Minimum2": "Min",
# optype that gets converted
"Identity": "Dropout",
"Affine": "Gemm",
# optype that should get merged
# with other operators
Expand Down Expand Up @@ -113,12 +113,6 @@ def convert_to_nodes(func, variables, input_types, output_types, broadcast_targe
attr = onnx.helper.make_attribute("is_test", 0)
n.attribute.extend([attr])
nl.append(n)
elif func.type == "Identity":
# Convert Identity to a Dropout with is_test=true
# so we just copy the input to output
attr = onnx.helper.make_attribute("is_test", 1)
n.attribute.extend([attr])
nl.append(n)
elif func.type == "MaxPooling":
mpp = func.max_pooling_param
if not mpp.ignore_border:
Expand Down
1 change: 1 addition & 0 deletions python/src/nnabla/utils/converter/onnx/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"Greater": "Greater",
"Equal": "Equal",
"Exp": "Exp",
"Identity": "Identity",
# optype with different names
"Relu": "ReLU",
"Concat": "Concatenate",
Expand Down
14 changes: 14 additions & 0 deletions python/test/utils/conversion/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,20 @@ def test_nnp_onnx_conversion_exp(tmpdir, nnp_fixture):
"out_data_1", "exec_0")


def test_onnx_nnp_conversion_identity(tmpdir, nnp_fixture):
convert_onnx_to_nnp_and_compare(tmpdir, TEST_DATA_DIR,
"identity.onnx",
"identity.nnp",
"out_data_1", "exec_0")


def test_nnp_onnx_conversion_identity(tmpdir, nnp_fixture):
convert_nnp_to_onnx_and_compare(tmpdir, TEST_DATA_DIR,
"identity.nnp",
"identity.onnx",
"out_data_1", "exec_0")


# These following tests are invalidated due to a
# backend bug? decribed in the following issue:
# https://github.com/Microsoft/CNTK/issues/3127
Expand Down

0 comments on commit 60b9166

Please sign in to comment.