youxiudeshouyeren commented on code in PR #15682:
URL: https://github.com/apache/tvm/pull/15682#discussion_r1319297402
##########
src/relay/transforms/simplify_expr.cc:
##########
@@ -326,6 +326,56 @@ static std::vector<int> GetTransposeAxisOrder(const Call&
call, int ndim) {
return std::move(attr_axes);
}
+/*!
+ * \brief SimplifyClipCastClip matches the pattern clip->cast->clip and fuse
clips based on Clip
+ * min/max values.
+ *
+ * Example:
+ * %1 = clip(%0, a_min=0f, a_max=255f) [type=int32]
+ * %2 = cast(%1, dtype="uint8") [type=uint8]
+ * %3 = clip(%2, a_min=20f, a_max=66f) [type=uint8]
+ *
+ * Optimized to (fuse Clips):
+ * %1 = clip(%0, a_min=20f, a_max=66f) [type=uint8]
+ * %2 = cast(%1, dtype="uint8") [type=uint8]
+ */
Review Comment:
I realize it was my example that was written incorrectly, the first data
type is int32. It should be:
```
* Optimized to (fuse Clips):
* %1 = clip(%0, a_min=20f, a_max=66f) [type=int32]
* %2 = cast(%1, dtype="uint8") [type=uint8]
*/
```
I'll correct the example in the comment.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]