Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hannk] requantize() should never skip the operation #6350

Merged
merged 3 commits into from
Oct 26, 2021
Merged
Changes from 1 commit
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
11 changes: 2 additions & 9 deletions apps/hannk/interpreter/ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,8 @@ void mul_uint8(const HalideBuffer<const void> &in1, const QuantizationInfo &in1q
void requantize(const HalideBuffer<const void> &in, const QuantizationInfo &inq,
HalideBuffer<void> out, const QuantizationInfo &outq,
ActivationFunction activation = ActivationFunction::None) {
if (inq == outq) {
// Some of these are just copies, or no-ops.
if (is_alias(in.raw_buffer(), out.raw_buffer())) {
return;
} else {
out.copy_from(in);
}
} else if (in.type() == halide_type_of<uint8_t>() &&
out.type() == halide_type_of<uint8_t>()) {
if (in.type() == halide_type_of<uint8_t>() &&
out.type() == halide_type_of<uint8_t>()) {
// TODO: Maybe a dedicated pipeline for this would be better. It
// could be a little faster, and avoid some quantization error.
add_uint8(in, inq, 1, in, inq, 0, out, outq, activation);
Expand Down