Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/tvm/relax/frontend/tflite/tflite_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,8 @@ def quantize(x):

# Get min/max of the output dtype. This will be used to ensure that clip a_min/a_max are not
# beyond the dtype range.
qmin = float(tvm.tir.op.min_value(dtype).value)
qmax = float(tvm.tir.op.max_value(dtype).value)
qmin = float(tvm.tirx.min_value(dtype).value)
qmax = float(tvm.tirx.max_value(dtype).value)

# The input expr is a quantized tensor with its scale and zero point. We calculate the
# suitable clip off points based on these scale and zero point.
Expand Down Expand Up @@ -1117,8 +1117,8 @@ def quantize(x):
# Get min/max of the input dtype. This will be used to ensure that
# clip a_min/a_max are not beyond the dtype range.
input_tensor_type_str = self.get_tensor_type_str(input_tensor.tensor.Type())
qmin = float(tvm.tir.op.min_value(input_tensor_type_str).value)
qmax = float(tvm.tir.op.max_value(input_tensor_type_str).value)
qmin = float(tvm.tirx.min_value(input_tensor_type_str).value)
qmax = float(tvm.tirx.max_value(input_tensor_type_str).value)

out = relax.op.clip(
in_expr, min=max(qmin, quantize(-1.0)), max=min(qmax, quantize(1.0))
Expand Down
Loading