Change activation implementation to use template
Prepare to support more type (int32, uint32, etc)
Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
namespace cker
{
-inline float ActivationFunctionWithMinMax(float x, float output_activation_min,
- float output_activation_max)
+template <typename T>
+inline T ActivationFunctionWithMinMax(T x, T output_activation_min, T output_activation_max)
{
- return std::min(std::max(x, output_activation_min), output_activation_max);
+ return std::min<T>(std::max<T>(x, output_activation_min), output_activation_max);
}
inline int32_t MultiplyByQuantizedMultiplier(int32_t x, int32_t quantized_multiplier, int shift)