Skip to content

Commit

Permalink
Fix PReLU conversion from CoreML (#425)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Dudalev <michael@dudalev.com>

Co-authored-by: Wenbing Li <10278425+wenbingl@users.noreply.github.com>
  • Loading branch information
dudalev and wenbingl authored Jan 7, 2021
1 parent 7631c1a commit bf8e1c4
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
# license information.
# --------------------------------------------------------------------------

import numpy as np

from ....common._apply_operation import apply_elu, apply_hard_sigmoid, apply_leaky_relu, apply_prelu, apply_relu, \
apply_sigmoid, apply_tanh, apply_affine, apply_parametric_softplus, apply_scaled_tanh
apply_sigmoid, apply_tanh, apply_affine, apply_parametric_softplus, apply_scaled_tanh, apply_thresholded_relu
from ....common._registration import register_converter


Expand All @@ -24,7 +26,7 @@ def convert_activation(scope, operator, container):
elif activation_type == 'ReLU':
apply_relu(scope, inputs, outputs, container, operator_name=attrs['name'])
elif activation_type == 'PReLU':
apply_prelu(scope, inputs, outputs, container, operator_name=attrs['name'], slope=[params.PReLU.alpha])
apply_prelu(scope, inputs[0], outputs, container, operator_name=attrs['name'], slope=np.asarray([params.PReLU.alpha.floatValue]))
elif activation_type == 'ELU':
apply_elu(scope, inputs, outputs, container, operator_name=attrs['name'], alpha=params.ELU.alpha)
elif activation_type == 'tanh':
Expand Down

0 comments on commit bf8e1c4

Please sign in to comment.