From dffdb23b64f81df758a2fd86107f18d8f63e35bf Mon Sep 17 00:00:00 2001 From: Ishi Tatsuyuki Date: Thu, 8 Oct 2020 21:37:57 +0900 Subject: [PATCH] Fix leakyReLU support for CoreML (#6651) 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 --- python/tvm/relay/frontend/coreml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tvm/relay/frontend/coreml.py b/python/tvm/relay/frontend/coreml.py index e510d6a24ac9..4efe014b9ffd 100644 --- a/python/tvm/relay/frontend/coreml.py +++ b/python/tvm/relay/frontend/coreml.py @@ -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"))