chromium/third_party/tflite/src/tensorflow/lite/delegates/xnnpack/quantization_util.cc

/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#include "tensorflow/lite/delegates/xnnpack/quantization_util.h"

#include <algorithm>

#include "fp16.h"  // from @FP16
#include "tensorflow/lite/kernels/internal/optimized/optimized_ops.h"
#include "tensorflow/lite/kernels/internal/reference/dequantize.h"
#include "tensorflow/lite/kernels/internal/runtime_shape.h"
#include "tensorflow/lite/kernels/internal/types.h"

namespace tflite {
namespace xnnpack {

void DequantizeFloat16(const uint16_t *packed_fp16_data,
                       float *unpacked_fp32_data, size_t tensor_elements) {}

void DequantizeInt8(const int8_t *packed_s8_data, float *unpacked_fp32_data,
                    const RuntimeShape &tensor_shape, int32_t zero_point,
                    double scale) {}

void PerChannelDequantizeInt8(const int8_t* packed_s8_data,
                              float* unpacked_fp32_data,
                              const RuntimeShape& tensor_shape,
                              const int32_t* zero_points, const float* scales,
                              int32_t quantized_dimension) {}

}  // namespace xnnpack
}  // namespace tflite