Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support ClippedReLU #44

Merged
merged 1 commit into from
Nov 15, 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
1 change: 1 addition & 0 deletions onnx_chainer/functions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from onnx_chainer.functions.activation import convert_ClippedReLU # NOQA
from onnx_chainer.functions.activation import convert_ELU # NOQA
from onnx_chainer.functions.activation import convert_HardSigmoid # NOQA
from onnx_chainer.functions.activation import convert_LeakyReLU # NOQA
Expand Down
14 changes: 14 additions & 0 deletions onnx_chainer/functions/activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
from onnx_chainer import mapping


def convert_ClippedReLU(func, onnx_op_name, opset_version, input_names, output_names, parameters):
if opset_version == 1:
return helper.make_node(
onnx_op_name, input_names, output_names,
min=0.0, max=func.cap,
consumed_inputs=[1]
),
elif opset_version == 6:
return helper.make_node(
onnx_op_name, input_names, output_names,
min=0.0, max=func.cap,
),


def convert_ELU(func, onnx_op_name, opset_version, input_names, output_names, parameters):
if opset_version == 1:
return helper.make_node(
Expand Down
1 change: 1 addition & 0 deletions onnx_chainer/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# Chainer Function -> (ONNX Operator, Operator set IDs)
operators = {
# Activation
'ClippedReLU': ('Clip', (1, 6)),
'ELU': ('Elu', (1, 6)),
'HardSigmoid': ('HardSigmoid', (1, 6)),
'LeakyReLU': ('LeakyRelu', (1, 6)),
Expand Down
1 change: 1 addition & 0 deletions tests/functions_tests/test_activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


@testing.parameterize(
{'name': 'clipped_relu'},
{'name': 'elu'},
{'name': 'hard_sigmoid'},
{'name': 'leaky_relu'},
Expand Down