18#include "kernels/Utils.h"
20#include <tensorflow/lite/kernels/internal/reference/comparisons.h>
37 if (
x()->element_type() == DataType::U8)
47 switch (
x()->element_type())
49 case DataType::FLOAT32:
53 evalInteger<int64_t>();
56 evalInteger<int32_t>();
62 throw std::runtime_error(
"luci-intp LessEqual Unsupported type.");
66void LessEqual::evalFloat()
const
68 const auto x_data = getTensorData<float>(
x());
69 const auto y_data = getTensorData<float>(
y());
70 auto output_data = getTensorData<bool>(
output());
72 tflite::ComparisonParams op_params;
75 if (op_params.is_broadcast)
77 tflite::reference_ops::Broadcast4DSlowLessEqual(op_params,
getTensorShape(
x()), x_data,
88template <
typename T>
void LessEqual::evalInteger()
const
90 const auto x_data = getTensorData<T>(
x());
91 const auto y_data = getTensorData<T>(
y());
94 tflite::ComparisonParams op_params;
97 if (op_params.is_broadcast)
99 tflite::reference_ops::Broadcast4DSlowLessEqualNoScaling(op_params,
getTensorShape(
x()), x_data,
105 tflite::reference_ops::LessEqualNoScaling(op_params,
getTensorShape(
x()), x_data,
111void LessEqual::evalQuantized()
const
113 const auto x_data = getTensorData<uint8_t>(
x());
114 const auto y_data = getTensorData<uint8_t>(
y());
117 tflite::ComparisonParams op_params;
118 op_params.left_shift = 8;
120 op_params.input1_shift = _x_shift;
121 op_params.input1_multiplier = _x_multiplier;
123 op_params.input2_shift = _y_shift;
124 op_params.input2_multiplier = _y_multiplier;
127 if (op_params.is_broadcast)
129 tflite::reference_ops::Broadcast4DSlowLessEqualWithScaling(
135 tflite::reference_ops::LessEqualWithScaling(op_params,
getTensorShape(
x()), x_data,
void resize(const Shape &new_shape)
const Shape & shape() const
int32_t zero_point() const
void execute() const override
void configure() override
LessEqual(const Tensor *x, const Tensor *y, Tensor *output)
#define LUCI_INTERPRETER_CHECK(cond)
Shape calculateShapeForBroadcast(const Shape &input1_shape, const Shape &input2_shape)
tflite::RuntimeShape getTensorShape(const Tensor *tensor)
void quantizeMultiplierSmallerThanOneExp(double double_multiplier, int32_t *quantized_multiplier, int *left_shift)