#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SUB_H_
#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SUB_H_
#include <stdint.h>
#include <algorithm>
#include <cstddef>
#include <limits>
#include "ruy/profiler/instrumentation.h"
#include "tensorflow/lite/kernels/internal/common.h"
#include "tensorflow/lite/kernels/internal/compatibility.h"
#include "tensorflow/lite/kernels/internal/types.h"
namespace tflite {
namespace reference_ops {
template <class T>
struct SubImpl { … };
template <>
struct SubImpl<int32_t> { … };
template <typename T, typename F>
inline void BroadcastSubRecursiveDimensions(
int dimension, const ArithmeticParams& params, const T* input1_data,
const T* input2_data, T* output_data, size_t* input1_offset_p,
size_t* input2_offset_p, size_t* output_offset,
size_t* compressed_input1_stride, size_t* compressed_input2_stride,
size_t* compressed_output_shape, F binary_func) { … }
template <typename T, typename F>
inline void BroadcastSubCommon(const ArithmeticParams& params,
const RuntimeShape& input1_shape,
const T* input1_data,
const RuntimeShape& input2_shape,
const T* input2_data,
const RuntimeShape& output_shape, T* output_data,
F binary_func) { … }
template <typename T>
void BroadcastSubSlow(const ArithmeticParams& params,
const RuntimeShape& input1_shape, const T* input1_data,
const RuntimeShape& input2_shape, const T* input2_data,
const RuntimeShape& output_shape, T* output_data) { … }
inline void BroadcastSub16POTSlow(const ArithmeticParams& params,
const RuntimeShape& input1_shape,
const int16_t* input1_data,
const RuntimeShape& input2_shape,
const int16_t* input2_data,
const RuntimeShape& output_shape,
int16_t* output_data) { … }
template <typename T>
void BroadcastQuantSubSlow(const ArithmeticParams& params,
const RuntimeShape& input1_shape,
const T* input1_data,
const RuntimeShape& input2_shape,
const T* input2_data,
const RuntimeShape& output_shape, T* output_data) { … }
template <typename T>
inline void SubElementwise(int size, const ArithmeticParams& params,
const T* input1_data, const T* input2_data,
T* output_data) { … }
inline void Sub(const ArithmeticParams& params,
const RuntimeShape& input1_shape, const uint8_t* input1_data,
const RuntimeShape& input2_shape, const uint8_t* input2_data,
const RuntimeShape& output_shape, uint8_t* output_data) { … }
inline void Sub(const ArithmeticParams& params,
const RuntimeShape& input1_shape, const int8_t* input1_data,
const RuntimeShape& input2_shape, const int8_t* input2_data,
const RuntimeShape& output_shape, int8_t* output_data) { … }
inline void Sub(const ArithmeticParams& params,
const RuntimeShape& input1_shape, const int16_t* input1_data,
const RuntimeShape& input2_shape, const int16_t* input2_data,
const RuntimeShape& output_shape, int16_t* output_data) { … }
template <typename T>
void Sub(const ArithmeticParams& params, const RuntimeShape& input1_shape,
const T* input1_data, const RuntimeShape& input2_shape,
const T* input2_data, const RuntimeShape& output_shape,
T* output_data) { … }
inline void SetActivationMinMax(const ArithmeticParams& params,
int32_t* activation_min,
int32_t* activation_max) { … }
inline void SetActivationMinMax(const ArithmeticParams& params,
float* activation_min, float* activation_max) { … }
inline void SetActivationMinMax(const ArithmeticParams& params,
int64_t* activation_min,
int64_t* activation_max) { … }
template <typename T>
inline void SubWithActivation(
const ArithmeticParams& params, const RuntimeShape& input1_shape,
const T* input1_data, const RuntimeShape& input2_shape,
const T* input2_data, const RuntimeShape& output_shape, T* output_data) { … }
}
}
#endif