ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Pool2D.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 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#include "../KernelGenerator.h"
18#include "../Validator.h"
19
21#include <AclKernelGen.h>
22
24{
25
26void Validator::visit(const ir::operation::Pool2D &) { _supported = true; }
27
28void KernelGenerator::visit(const ir::operation::Pool2D &node)
29{
30 auto raw_fn = acl_common::kernelGenPool2D<::arm_compute::CLPoolingLayer>(
31 node, _ctx, _tensor_reg, acl_common::convertPoolType(node.param().op_type));
32
33 const auto ofm_index{node.getOutputs().at(0)};
34 auto ofm_tensor = _tensor_reg->getAclTensor(ofm_index);
35 const auto activation = node.param().activation;
36
37 using ActivationBuilder =
38 acl_common::AclActivationBuilder<::arm_compute::ICLTensor, ::arm_compute::CLActivationLayer,
39 acl_common::AclFunction>;
40
41 _return_fn = std::make_unique<exec::FunctionSequence>(
42 acl_common::asAclFunction(std::move(raw_fn)),
43 ActivationBuilder::generate(activation, ofm_tensor->handle()));
44}
45
46} // namespace onert::backend::acl_cl
std::unique_ptr< exec::IFunction > _return_fn
arm_compute::PoolingType convertPoolType(ir::operation::Pool2D::PoolType pool_type_ir)
Definition Convert.cc:281
std::unique_ptr< AclFunction > asAclFunction(std::unique_ptr<::arm_compute::IFunction > &&layer)
Definition Convert.cc:246
::onert::backend::acl_common::AclActivationBuilder< ::arm_compute::ITensor, ::arm_compute::NEActivationLayer, acl_common::AclFunction > ActivationBuilder