18#ifndef __NNFW_CKER_REFERENCE_BINARYARITHMETICOPS_H__
19#define __NNFW_CKER_REFERENCE_BINARYARITHMETICOPS_H__
36 const T *input1_data,
const Shape &input2_shape,
38 const std::function<T(
const T &,
const T &)> &fn)
41 for (
int i = 0; i < flat_size; ++i)
51 const float *input1_data,
const Shape &input2_shape,
54 const std::function<
float(
const float &,
const float &)> &fn)
57 for (
int i = 0; i <
size; i++)
66 const bool *input1_data,
const Shape &input2_shape,
69 const std::function<
bool(
const bool &,
const bool &)> &fn)
72 for (
int i = 0; i <
size; i++)
74 output_data[i] = fn(input1_data[i], input2_data[i]);
80 const int64_t *input1_data,
const Shape &input2_shape,
83 const std::function<int64_t(
const int64_t &,
const int64_t &)> &fn)
86 for (
int i = 0; i < flat_size; ++i)
117 for (
int b = 0; b < extended_output_shape.
Dims(0); ++b)
119 for (
int y = 0; y < extended_output_shape.
Dims(1); ++y)
121 for (
int x = 0; x < extended_output_shape.
Dims(2); ++x)
123 for (
int c = 0; c < extended_output_shape.
Dims(3); ++c)
125 output_data[
Offset(extended_output_shape, b, y, x, c)] = ActivationFunctionWithMinMax<T>(
136 const Shape &input1_shape,
const T *input1_data,
137 const Shape &input2_shape,
const T *input2_data,
139 const std::function<T(
const T &,
const T &)> &fn)
159 for (
int b = 0; b < extended_output_shape.
Dims(0); ++b)
161 for (
int y = 0; y < extended_output_shape.
Dims(1); ++y)
163 for (
int x = 0; x < extended_output_shape.
Dims(2); ++x)
165 for (
int c = 0; c < extended_output_shape.
Dims(3); ++c)
167 output_data[
Offset(extended_output_shape, b, y, x, c)] = ActivationFunctionWithMinMax<T>(
181 float *output_data,
const std::function<
float(
const float &,
const float &)> &fn)
188 for (
int b = 0; b < extended_output_shape.
Dims(0); ++b)
190 for (
int y = 0; y < extended_output_shape.
Dims(1); ++y)
192 for (
int x = 0; x < extended_output_shape.
Dims(2); ++x)
194 for (
int c = 0; c < extended_output_shape.
Dims(3); ++c)
196 output_data[
Offset(extended_output_shape, b, y, x, c)] =
210 const std::function<
bool(
const bool &,
const bool &)> &fn)
217 for (
int b = 0; b < extended_output_shape.
Dims(0); ++b)
219 for (
int y = 0; y < extended_output_shape.
Dims(1); ++y)
221 for (
int x = 0; x < extended_output_shape.
Dims(2); ++x)
223 for (
int c = 0; c < extended_output_shape.
Dims(3); ++c)
225 output_data[
Offset(extended_output_shape, b, y, x, c)] =
238 int64_t *output_data,
const std::function<int64_t(
const int64_t &,
const int64_t &)> &fn)
245 for (
int b = 0; b < extended_output_shape.
Dims(0); ++b)
247 for (
int y = 0; y < extended_output_shape.
Dims(1); ++y)
249 for (
int x = 0; x < extended_output_shape.
Dims(2); ++x)
251 for (
int c = 0; c < extended_output_shape.
Dims(3); ++c)
253 output_data[
Offset(extended_output_shape, b, y, x, c)] =
int32_t Dims(int i) const
const luci_interpreter::RuntimeShape output_shape
std::enable_if_t< is_quant8< T >::value > BroadcastBinaryArithmeticOpSlow(const BinaryArithmeticOpParam ¶ms, const Shape &input1_shape, const T *input1_data, const Shape &input2_shape, const T *input2_data, const Shape &output_shape, T *output_data, const std::function< T(const BinaryArithmeticOpParam ¶ms, const T &, const T &)> &fn)
void BinaryArithmeticOp(const BinaryArithmeticOpParam ¶ms, const Shape &input1_shape, const T *input1_data, const Shape &input2_shape, const T *input2_data, const Shape &output_shape, T *output_data, const std::function< T(const T &, const T &)> &fn)
int Offset(const Shape &shape, int i0, int i1, int i2, int i3)
void NdArrayDescsForElementwiseBroadcast(const Shape &input0_shape, const Shape &input1_shape, NdArrayDesc< N > *desc0_out, NdArrayDesc< N > *desc1_out)
T ActivationFunctionWithMinMax(T x, T output_activation_min, T output_activation_max)
int MatchingElementsSize(const Shape &shape, const Shape &check_shape_0, const Shape &check_shape_1)
int SubscriptToIndex(const NdArrayDesc< 4 > &desc, int i0, int i1, int i2, int i3)
int32_t quantized_activation_max
int64_t int64_activation_min
int32_t quantized_activation_min
float float_activation_max
int64_t int64_activation_max
float float_activation_min