#include <assert.h>
#include <inttypes.h>
#include <math.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <fp16/fp16.h>
#include "xnnpack.h"
#include "xnnpack/allocator.h"
#include "xnnpack/common.h"
#include "xnnpack/compute.h"
#include "xnnpack/config-types.h"
#include "xnnpack/config.h"
#include "xnnpack/indirection.h"
#include "xnnpack/log.h"
#include "xnnpack/math.h"
#include "xnnpack/microkernel-type.h"
#include "xnnpack/operator-type.h"
#include "xnnpack/operator-utils.h"
#include "xnnpack/operator.h"
#include "xnnpack/params.h"
#include "pthreadpool.h"
static inline size_t compute_output_dimension_with_tf_same_padding(
size_t input_dimension,
size_t stride_dimension)
{ … }
enum xnn_status create_average_pooling2d_nhwc(
uint32_t input_padding_top,
uint32_t input_padding_right,
uint32_t input_padding_bottom,
uint32_t input_padding_left,
uint32_t pooling_height,
uint32_t pooling_width,
uint32_t stride_height,
uint32_t stride_width,
float output_min,
float output_max,
uint32_t flags,
enum xnn_operator_type operator_type,
xnn_operator_t average_pooling_op)
{ … }
enum xnn_status xnn_create_average_pooling2d_nhwc_qu8(
uint32_t input_padding_top,
uint32_t input_padding_right,
uint32_t input_padding_bottom,
uint32_t input_padding_left,
uint32_t pooling_height,
uint32_t pooling_width,
uint32_t stride_height,
uint32_t stride_width,
uint8_t input_zero_point,
float input_scale,
uint8_t output_zero_point,
float output_scale,
uint8_t output_min,
uint8_t output_max,
uint32_t flags,
xnn_operator_t* average_pooling_op_out)
{ … }
enum xnn_status xnn_create_average_pooling2d_nhwc_f16(
uint32_t input_padding_top,
uint32_t input_padding_right,
uint32_t input_padding_bottom,
uint32_t input_padding_left,
uint32_t pooling_height,
uint32_t pooling_width,
uint32_t stride_height,
uint32_t stride_width,
float output_min,
float output_max,
uint32_t flags,
xnn_operator_t* average_pooling_op_out)
{ … }
enum xnn_status xnn_create_average_pooling2d_nhwc_f32(
uint32_t input_padding_top,
uint32_t input_padding_right,
uint32_t input_padding_bottom,
uint32_t input_padding_left,
uint32_t pooling_height,
uint32_t pooling_width,
uint32_t stride_height,
uint32_t stride_width,
float output_min,
float output_max,
uint32_t flags,
xnn_operator_t* average_pooling_op_out)
{ … }
static enum xnn_status reshape_average_pooling2d(
xnn_operator_t average_pooling_op,
size_t batch_size,
size_t input_height,
size_t input_width,
size_t channels,
size_t input_pixel_stride,
size_t output_pixel_stride,
size_t* workspace_size,
size_t* workspace_alignment,
uint32_t log2_data_element_size,
uint32_t log2_weight_element_size,
uint32_t log2_accumulator_element_size,
xnn_indirection_init_pavgpool2d_fn indirection_init_pavgpool2d,
const struct xnn_avgpool_config avgpool[restrict XNN_MIN_ELEMENTS(1)],
const struct xnn_pavgpool_config pavgpool[restrict 1],
const struct xnn_gavgpool_config gavgpool[restrict XNN_MIN_ELEMENTS(1)],
const void* params,
size_t params_size,
const void* global_params,
size_t global_params_size,
size_t* output_height_out,
size_t* output_width_out,
pthreadpool_t threadpool,
enum xnn_operator_type operator_type,
bool is_pixelwise)
{ … }
enum xnn_status xnn_reshape_average_pooling2d_nhwc_qu8(
xnn_operator_t average_pooling_op,
size_t batch_size,
size_t input_height,
size_t input_width,
size_t channels,
size_t input_pixel_stride,
size_t output_pixel_stride,
size_t* workspace_size,
size_t* workspace_alignment,
size_t* output_height_out,
size_t* output_width_out,
pthreadpool_t threadpool)
{ … }
enum xnn_status xnn_reshape_average_pooling2d_nhwc_f16(
xnn_operator_t average_pooling_op,
size_t batch_size,
size_t input_height,
size_t input_width,
size_t channels,
size_t input_pixel_stride,
size_t output_pixel_stride,
size_t* workspace_size,
size_t* workspace_alignment,
size_t* output_height_out,
size_t* output_width_out,
pthreadpool_t threadpool)
{ … }
enum xnn_status xnn_reshape_average_pooling2d_nhwc_f32(
xnn_operator_t average_pooling_op,
size_t batch_size,
size_t input_height,
size_t input_width,
size_t channels,
size_t input_pixel_stride,
size_t output_pixel_stride,
size_t* workspace_size,
size_t* workspace_alignment,
size_t* output_height_out,
size_t* output_width_out,
pthreadpool_t threadpool)
{ … }
static enum xnn_status setup_average_pooling2d(
xnn_operator_t average_pooling_op,
void* workspace,
const void* input,
void* output)
{ … }
enum xnn_status xnn_setup_average_pooling2d_nhwc_qu8(
xnn_operator_t average_pooling_op,
void* workspace,
const uint8_t* input,
uint8_t* output)
{ … }
enum xnn_status xnn_setup_average_pooling2d_nhwc_f16(
xnn_operator_t average_pooling_op,
void* workspace,
const void* input,
void* output)
{ … }
enum xnn_status xnn_setup_average_pooling2d_nhwc_f32(
xnn_operator_t average_pooling_op,
void* workspace,
const float* input,
float* output)
{ … }