Skip to content

Commit 7361649

Browse files
hsharma35facebook-github-bot
authored andcommitted
Fix -Wimplicit-const-int-float-conversion error. (pytorch#15982)
Summary: as titled Reviewed By: skrtskrtfb, zonglinpeng Differential Revision: D87882617
1 parent 12d17ef commit 7361649

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backends/cadence/vision/kernels/kernels.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ void* allocate_temp_memory(KernelRuntimeContext& ctx, size_t size) {
2525
// Quantize a fp32 value to an int8_t/uint8_t value
2626
template <typename T>
2727
T quantize(const float x, float scale, int32_t zero_point) {
28-
constexpr float min_val = std::numeric_limits<T>::min();
29-
constexpr float max_val = std::numeric_limits<T>::max();
28+
constexpr float min_val = static_cast<float>(std::numeric_limits<T>::min());
29+
constexpr float max_val = static_cast<float>(std::numeric_limits<T>::max());
3030
float tmp = roundf(x * scale + zero_point);
3131
return std::max(std::min(tmp, max_val), min_val);
3232
}

0 commit comments

Comments
 (0)