Skip to content
Open
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
4 changes: 2 additions & 2 deletions backends/cadence/vision/kernels/kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ void* allocate_temp_memory(KernelRuntimeContext& ctx, size_t size) {
// Quantize a fp32 value to an int8_t/uint8_t value
template <typename T>
T quantize(const float x, float scale, int32_t zero_point) {
constexpr float min_val = std::numeric_limits<T>::min();
constexpr float max_val = std::numeric_limits<T>::max();
constexpr float min_val = static_cast<float>(std::numeric_limits<T>::min());
constexpr float max_val = static_cast<float>(std::numeric_limits<T>::max());
float tmp = roundf(x * scale + zero_point);
return std::max(std::min(tmp, max_val), min_val);
}
Expand Down