masahi commented on a change in pull request #8126: URL: https://github.com/apache/tvm/pull/8126#discussion_r639123960
########## File path: src/relay/transforms/quantize_fake_quantization.cc ########## @@ -0,0 +1,296 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file src/relay/transforms/simplify_expr.cc + * \brief A pass for simplifying the Relay expression. + */ + +#include <tvm/relay/expr.h> +#include <tvm/relay/expr_functor.h> +#include <tvm/relay/transform.h> + +/* Description of QuantizeFakeQuantization + * + * The purpose of this pass is to find regions of the graph that follow + * the general pattern: + * + * x w + * | | + * dq dq + * \ / + * op1 + * | + * op2 + * | + * q + * + * and convert them into subgraphs with actual integer operations on x and w + * + * The pass does this via a multi-pass approach: + * + * The main pass is a MixedModeMutator that traverses the full graph searching for + * quantize operations + * + * The second pass is an ExprVisitor that recursively searches for subgraphs leading to the + * quantize for subtraphs bounded by dequantize operations. This pass extracts the affine + * types of the inputs for later processing + * + * The third pass is an ExprMutator the recursively rewrites the subgraphs using packed funcs Review comment: that recursively -- 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. For queries about this service, please contact Infrastructure at: [email protected]
