Skip to content

Commit

Permalink
One more little one (#5)
Browse files Browse the repository at this point in the history
* Fixed fake quantize issues.

* Formatting.

* Cleanup unused imports

* Fix real int8 tests.

* Fix requantize shape bug.
  • Loading branch information
Josh Fromm authored and Matthew committed Sep 7, 2021
1 parent fefca2c commit c4c746b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/relay/qnn/op/requantize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ Expr RequantizeLower(const Expr& input_tensor, const Expr& input_scale,
auto zero_scalar = MakeConstantScalar(DataType::Int(32), 0);
if (!IsEqualScalar(input_zero_point, zero_scalar)) {
// Broadcast input zero point if needed.
Expr input_zero_broadcast =
ExpandBiasToMatchAxis(input_zero_point, input_shape.size(), {param->axis});
Expr input_zero_broadcast = ExpandBiasToMatchAxis(Reshape(input_zero_point,
{
-1,
}),
input_shape.size(), {param->axis});
tensor = Subtract(tensor, Cast(input_zero_broadcast, DataType::Int(32)));
}

Expand Down

0 comments on commit c4c746b

Please sign in to comment.