kfeng123 commented on code in PR #15068:
URL: https://github.com/apache/tvm/pull/15068#discussion_r1227453557
##########
src/relay/transforms/simplify_expr.cc:
##########
@@ -234,30 +232,38 @@ class SimplifyClipAndConsecutiveCast : public
DFPatternRewrite {
* Optimized to (remove Clip):
* %1 = cast(%0, dtype="uint8") [type=uint8]
*/
-class SimplifyCastClip : public DFPatternRewrite {
+class SimplifyClip : public DFPatternRewrite {
public:
- SimplifyCastClip() {
- cast_ = IsOp("cast")({IsWildcard()});
- pattern_ = IsOp("clip")({cast_});
+ SimplifyClip() {
+ x_ = IsWildcard();
+ pattern_ = IsOp("clip")({x_});
}
Expr Callback(const Expr& pre, const Expr& post,
const Map<DFPattern, Array<Expr>>& node_map) const override {
- auto cast = Downcast<Call>(node_map[cast_][0]);
- DataType cast_dtype = Downcast<TensorType>(cast->checked_type())->dtype;
+ DataType cast_dtype = Downcast<TensorType>(pre->checked_type())->dtype;
- auto clip = Downcast<Call>(post);
- const CallNode* clip_node = clip.as<CallNode>();
+ const CallNode* clip_node = post.as<CallNode>();
const ClipAttrs* clip_attrs = clip_node->attrs.as<ClipAttrs>();
+ // TODO(kfeng123): For now, the arg of "clip" is forced to not be
"qnn.requantize" and
+ // "ann.add". This is to avoid destroying the structure required by
LegalizeQnnOpForDnnl
Review Comment:
Thanks. Typo fixed.
--
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]