18#include "kernels/Utils.h"
36 if (
input()->element_type() == DataType::U8)
46 switch (
input()->element_type())
48 case DataType::FLOAT32:
55 throw std::runtime_error(
"luci-intp Relu6 Unsupported type.");
59void Relu6::evalFloat()
const
61 const auto input_data = getTensorData<float>(
input());
63 auto output_data = getTensorData<float>(
output());
66 luci_interpreter_pal::Relu6(input_shape, input_data,
output_shape, output_data);
69void Relu6::evalQuantized()
const
71 tflite::ReluParams params;
74 params.output_multiplier = _output_multiplier;
75 params.output_shift = _output_shift;
77 params.quantized_activation_min =
78 std::max(
static_cast<int32_t
>(std::numeric_limits<uint8_t>::min()), params.output_offset);
79 params.quantized_activation_max =
80 std::min(
static_cast<int32_t
>(std::numeric_limits<uint8_t>::max()),
81 params.output_offset +
static_cast<int32>(roundf(6.f /
output()->scale())));
void resize(const Shape &new_shape)
int32_t zero_point() const
Relu6(const Tensor *input, Tensor *output)
void configure() override
void execute() const override
const Tensor * input() const
#define LUCI_INTERPRETER_CHECK(cond)
const luci_interpreter::RuntimeShape output_shape
tflite::RuntimeShape getTensorShape(const Tensor *tensor)
void quantizeMultiplier(double double_multiplier, int32_t *quantized_multiplier, int *shift)