You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "jikechao (via GitHub)" <gi...@apache.org> on 2023/09/11 03:51:17 UTC
[GitHub] [tvm] jikechao commented on a diff in pull request #15715: [Relay][Bugfix] Fix the wrong implementation about operator Threshold in oneflow
jikechao commented on code in PR #15715:
URL: https://github.com/apache/tvm/pull/15715#discussion_r1320964433
##########
python/tvm/relay/frontend/oneflow.py:
##########
@@ -1025,15 +1025,17 @@ def _impl_v1(cls, inputs, attrs, params):
return out
-class ThresholdedRelu(OneFlowOpConverter):
- """Operator converter for ThresholdedRelu."""
+class Threshold(OneFlowOpConverter):
+ """Operator converter for Threshold."""
@classmethod
def _impl_v1(cls, inputs, attrs, params):
- alpha = float(attrs.get("alpha", 1.0))
- alpha_tensor = _op.full_like(inputs[0], fill_value=_expr.const(alpha))
- mask = _op.greater(inputs[0], alpha_tensor).astype("float32")
- return inputs[0] * mask
+ threshold = float(attrs.get("threshold_val", 1.0))
+ threshold_tensor = _op.full_like(inputs[0], fill_value=_expr.const(threshold))
+ value = float(attrs.get("value"))
+ value_tensor = _op.full_like(inputs[0], fill_value=_expr.const(value))
+ mask = _op.greater(inputs[0], threshold_tensor).astype("float32")
Review Comment:
@cbalint13 It has been corrected! Thanks for your review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org