ONE - On-device Neural Engine
Loading...
Searching...
No Matches
FullyConnected.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
27 acl_common::AclActivationBuilder<::arm_compute::ITensor, ::arm_compute::NEActivationLayer,
28 acl_common::AclFunction>;
29
30void Validator::visit(const ir::operation::FullyConnected &) { _supported = true; }
31
32void KernelGenerator::visit(const ir::operation::FullyConnected &node)
33{
34 const auto output_index{node.getOutputs().at(0)};
35 auto output_tensor = _tensor_reg->getAclTensor(output_index);
36 const auto activation = node.param().activation;
37 if (node.param().weights_format == ir::FullyConnectedWeightsFormat::Shuffled16x1Float32)
38 throw std::runtime_error(
39 "KernelGenerator(acl_neon): FullyConnected 16x1Float32 weights is not supported.");
40
41 auto fn = acl_common::kernelGenFullyConnected<acl_common::AclFunction, ::arm_compute::ITensor,
43 node, _ctx, _tensor_builder, _tensor_reg);
44 _return_fn = std::make_unique<exec::FunctionSequence>(
45 std::move(fn), ActivationBuilder::generate(activation, output_tensor->handle()));
46}
47
48} // namespace onert::backend::acl_neon
Class to run FullyConnected Layer after reshaping input tensor.
static std::unique_ptr< exec::IFunction > generate(ir::Activation code, T_Tensor *ifm_alloc)
std::unique_ptr< exec::IFunction > _return_fn
std::unique_ptr< exec::IFunction > kernelGenFullyConnected(const ir::operation::FullyConnected &node, const ir::Operands &operands, const std::shared_ptr< T_TensorBuilder > &tensor_builder, const std::shared_ptr< T_TensorRegistry > &tensor_reg)
::onert::backend::acl_common::AclActivationBuilder< ::arm_compute::ITensor, ::arm_compute::NEActivationLayer, acl_common::AclFunction > ActivationBuilder