AndrewZhaoLuo commented on a change in pull request #8883:
URL: https://github.com/apache/tvm/pull/8883#discussion_r702038057
##########
File path: python/tvm/ir/affine_type.py
##########
@@ -50,8 +50,10 @@ class TensorAffineType(AffineType):
The content data type.
Review comment:
Add axis field
##########
File path: python/tvm/relay/transform/fake_quantization_to_integer.py
##########
@@ -18,13 +18,22 @@
import tvm
from tvm import relay
from tvm.ir import TensorAffineType, TupleAffineType
+from tvm.tir import bijective_layout
from ..op import register_fake_quantization_to_integer
def fold_constant(expr):
Review comment:
Hmm can you use the functions in `python/tvm/relay/frontend/common.py`
or modify them slightly there to support your need?
##########
File path: python/tvm/ir/affine_type.py
##########
@@ -50,8 +50,10 @@ class TensorAffineType(AffineType):
The content data type.
"""
- def __init__(self, scale, zero_point, dtype):
- self.__init_handle_by_constructor__(_ffi_api.TensorAffineType, scale,
zero_point, dtype)
+ def __init__(self, scale, zero_point, dtype, axis=-1):
Review comment:
Would axis=1 be a more useful default? (since the channel dimension is
usually in dim 1)?
##########
File path: python/tvm/relay/transform/fake_quantization_to_integer.py
##########
@@ -18,13 +18,22 @@
import tvm
from tvm import relay
from tvm.ir import TensorAffineType, TupleAffineType
+from tvm.tir import bijective_layout
from ..op import register_fake_quantization_to_integer
def fold_constant(expr):
return relay.transform.FoldConstantExpr(expr, tvm.IRModule())
+def get_zeros(scale):
+ return fold_constant(relay.op.cast(relay.op.zeros_like(scale), "int32"))
Review comment:
Should this be a cast_like or do we always want things to be int32?
##########
File path: src/relay/qnn/op/dense.cc
##########
@@ -61,7 +61,6 @@ bool QnnDenseRel(const Array<Type>& types, int num_inputs,
const Attrs& attrs,
}
}
ICHECK(IsScalarType(types[2], DataType::Int(32))); //
input_zero_point
- ICHECK(IsScalarType(types[3], DataType::Int(32))); //
weight_zero_point
Review comment:
Probably want a comment or check on what the type for weight_zero_point
can be and why
--
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]