Skip to content

Commit

Permalink
Fix leakyReLU support for CoreML (#6651)
Browse files Browse the repository at this point in the history
The original implementation failed with the following error:

File "../include/tvm/runtime/packed_func.h", line 372
TVMError: Check failed: type_code_ == kDLFloat (8 vs. 2) : expected float but get Object
  • Loading branch information
ishitatsuyuki authored Oct 8, 2020
1 parent 35854c1 commit dffdb23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/tvm/relay/frontend/coreml.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _ActivationParams(op, inexpr, etab):
if whichActivation == "ReLU":
return _op.nn.relu(inexpr)
if whichActivation == "leakyReLU":
_op.nn.leaky_relu(inexpr, alpha=_expr.const(par.alpha, dtype="float32"))
return _op.nn.leaky_relu(inexpr, alpha=par.alpha)
elif whichActivation == "thresholdedReLU":
alpha_tensor = _op.full_like(inexpr, fill_value=_expr.const(par.alpha, dtype="float32"))
return _op.multiply(inexpr, _op.greater(inexpr, alpha_tensor).as_type("float32"))
Expand Down

0 comments on commit dffdb23

Please sign in to comment.