Skip to content

Commit

Permalink
fix(cpp): address failing template deduction with some compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
dacorvo committed Feb 9, 2024
1 parent 36124db commit 85acd36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion quanto/library/ext/cpp/quantize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ torch::Tensor quantize_symmetric_per_tensor(const torch::Tensor& input, const to
float inv_scale = float_scale == 0 ? 1.0f : 1.0f / float_scale;
for (const auto i : c10::irange(numel)) {
int64_t qvalue = lrintf(std::nearbyint(data[i] * inv_scale));
qvalue = std::max(-127LL, std::min(qvalue, 127LL));
qvalue = std::max<int64_t>(-127LL, std::min<int64_t>(qvalue, 127LL));
qdata[i] = static_cast<int8_t>(qvalue);
}
return output;
Expand Down

0 comments on commit 85acd36

Please sign in to comment.