ONE - On-device Neural Engine
Loading...
Searching...
No Matches
PALAveragePool2d.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef LUCI_INTERPRETER_PAL_AVERAGEPOOL2D_H
18#define LUCI_INTERPRETER_PAL_AVERAGEPOOL2D_H
19
20#include <tensorflow/lite/kernels/internal/reference/integer_ops/pooling.h>
21#include <tensorflow/lite/kernels/internal/reference/pooling.h>
22
24{
25template <typename T>
26static inline void AveragePool(const tflite::PoolParams &params,
27 const tflite::RuntimeShape &input_shape, const T *input_data,
28 const tflite::RuntimeShape &output_shape, T *output_data,
29 const tflite::RuntimeShape &scratchpad_shape, T *scratchpad_data)
30{
31 {
32 // MARK: At this moment this operation doesn't support
33 assert(false && "AveragePool NYI");
34 (void)params;
35 (void)input_shape;
36 (void)input_data;
37 (void)output_shape;
38 (void)output_data;
39 (void)scratchpad_shape;
40 (void)scratchpad_data;
41 }
42}
43
44template <>
45inline void AveragePool<int8_t>(const tflite::PoolParams &params,
46 const tflite::RuntimeShape &input_shape, const int8_t *input_data,
47 const tflite::RuntimeShape &output_shape, int8_t *output_data,
48 const tflite::RuntimeShape &scratchpad_shape,
49 int8_t *scratchpad_data)
50{
51 (void)scratchpad_shape;
52 (void)scratchpad_data;
53
54 tflite::reference_integer_ops::AveragePool(params, input_shape, input_data, output_shape,
55 output_data);
56}
57
58static inline void SetupScratchpadTensor(luci_interpreter::Tensor *scratchpad,
59 const luci_interpreter::DataType &input_data_type,
60 const tflite::RuntimeShape &input_shape,
61 const tflite::RuntimeShape &output_shape)
62
63{
64 (void)input_data_type;
65 (void)input_shape;
66 (void)output_shape;
67
68 scratchpad->set_allocatable(false);
69}
70
71} // namespace luci_interpreter_pal
72
73#endif // LUCI_INTERPRETER_PAL_AVERAGEPOOL2D_H
void set_allocatable(bool value)
Definition Tensor.h:168
const luci_interpreter::RuntimeShape output_shape
void AveragePool< int8_t >(const tflite::PoolParams &params, const tflite::RuntimeShape &input_shape, const int8_t *input_data, const tflite::RuntimeShape &output_shape, int8_t *output_data, const tflite::RuntimeShape &scratchpad_shape, int8_t *scratchpad_data)
DataType
"scalar" value type
Definition DataType.h:32
void AveragePool(const PoolParams &, const Shape &, const T *, const Shape &, T *)
Definition AveragePool.h:36