You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "cbalint13 (via GitHub)" <gi...@apache.org> on 2023/09/09 21:00:22 UTC

[GitHub] [tvm] cbalint13 commented on a diff in pull request #15715: [Relay][Bugfix] Fix the wrong implementation about operator Threshold in oneflow

cbalint13 commented on code in PR #15715:
URL: https://github.com/apache/tvm/pull/15715#discussion_r1320653395


##########
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:
   should't it be of any universal ```dtype``` ?
   thinking of other types i.e. int in case of quantized things.



-- 
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