ONE - On-device Neural Engine
Loading...
Searching...
No Matches
L2Pool2D.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
3 * Copyright 2017 The TensorFlow Authors. All Rights Reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#include "Pool2DCommon.h"
19
20#include "PALL2Pool2D.h"
21
22namespace luci_interpreter
23{
24void configure_kernel_CircleL2Pool2D(const circle::Operator *cur_op,
25 BaseRuntimeGraph *runtime_graph)
26{
27 configure_kernel_CirclePool2DCommon(cur_op, runtime_graph);
28}
29
30void execute_kernel_CircleL2Pool2D(const circle::Operator *cur_op, BaseRuntimeGraph *runtime_graph)
31{
32 const kernels::SISOKernel siso_kernel(cur_op, runtime_graph);
33
34 const auto input = siso_kernel.input();
35 const auto output = siso_kernel.output();
36
37 const auto *input_data = runtime_graph->getDataByTensor(input);
38 auto *output_data = runtime_graph->getDataByTensor(output);
39
40 const DataType input_type = Tensor::element_type(input);
41
42 const auto params = createPoolParams(cur_op, siso_kernel);
43
44 switch (input_type)
45 {
46#ifndef DIS_FLOAT
47 case DataType::FLOAT32:
48 luci_interpreter_pal::L2Pool(
49 params, kernels::getTensorShape(input), kernels::getTensorData<float>(input_data),
50 kernels::getTensorShape(output), kernels::getTensorData<float>(output_data));
51 break;
52#endif // DIS_FLOAT
53 default:
54 assert(false && "Unsupported type.");
55 }
56}
57
58} // namespace luci_interpreter
uint8_t * getDataByTensor(const circle::Tensor *raw_tensor)
const circle::Tensor * output() const
Definition SISOKernel.h:47
const circle::Tensor * input() const
Definition SISOKernel.h:46
tflite::RuntimeShape getTensorShape(const Tensor *tensor)
Definition Utils.h:194
luci_interpreter_pal::PoolParams createPoolParams(const circle::Operator *cur_op, const kernels::SISOKernel &siso_kernel)
void configure_kernel_CirclePool2DCommon(const circle::Operator *cur_op, BaseRuntimeGraph *runtime_graph)
void execute_kernel_CircleL2Pool2D(const circle::Operator *cur_op, BaseRuntimeGraph *runtime_graph)
Definition L2Pool2D.cpp:30
void configure_kernel_CircleL2Pool2D(const circle::Operator *cur_op, BaseRuntimeGraph *runtime_graph)
Definition L2Pool2D.cpp:24
DataType
"scalar" value type
Definition DataType.h:32