Compute Library
 23.11
NEGEMMLowpOutputStage.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2021 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
25 
28 
30 
31 namespace arm_compute
32 {
33 struct NEGEMMLowpOutputStage::Impl
34 {
35  const ITensor *src{nullptr};
36  const ITensor *bias{nullptr};
37  ITensor *dst{nullptr};
38  ITensorPack run_pack{};
39  std::unique_ptr<cpu::CpuGemmLowpOutputStage> op{nullptr};
40 };
41 
42 NEGEMMLowpOutputStage::NEGEMMLowpOutputStage() : _impl(std::make_unique<Impl>())
43 {
44 }
46 
48  const ITensor *bias,
49  ITensor *output,
51 {
52  // Perform validate step
55  NEGEMMLowpOutputStage::validate(input->info(), bias != nullptr ? bias->info() : nullptr, output->info(), info));
56  _impl->src = input;
57  _impl->bias = bias;
58  _impl->dst = output;
59  _impl->op = std::make_unique<cpu::CpuGemmLowpOutputStage>();
60  _impl->op->configure(input->info(), (bias == nullptr) ? nullptr : bias->info(), output->info(), info);
61 
62  _impl->run_pack = {
63  {TensorType::ACL_SRC, _impl->src}, {TensorType::ACL_BIAS, _impl->bias}, {TensorType::ACL_DST, _impl->dst}};
64 }
65 
67  const ITensorInfo *bias,
68  const ITensorInfo *output,
70 {
72 }
73 
75 {
76  _impl->op->run(_impl->run_pack);
77 }
78 } // namespace arm_compute
arm_compute::test::validation::src
SimpleTensor< float > src
Definition: DFT.cpp:155
arm_compute::NEGEMMLowpOutputStage::configure
void configure(const ITensor *input, const ITensor *bias, ITensor *output, const GEMMLowpOutputStageInfo &info)
Initialise the kernel's inputs, output.
Definition: NEGEMMLowpOutputStage.cpp:47
arm_compute::GEMMLowpOutputStageInfo
GEMMLowp output stage info.
Definition: GEMMInfo.h:45
arm_compute::test::validation::dst
auto dst
Definition: DFT.cpp:170
arm_compute::NEGEMMLowpOutputStage::validate
static Status validate(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const GEMMLowpOutputStageInfo &info)
Static function to check if given info will lead to a valid configuration of NEGEMMLowpOutputStage.
Definition: NEGEMMLowpOutputStage.cpp:66
NEGEMMLowpOutputStage.h
CpuGemmLowpOutputStage.h
arm_compute::ITensor
Interface for CPU tensor.
Definition: ITensor.h:36
ARM_COMPUTE_ERROR_ON_NULLPTR
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:159
arm_compute::ITensor::info
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
ARM_COMPUTE_ERROR_THROW_ON
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
arm_compute::ACL_DST
@ ACL_DST
Definition: Types.h:55
arm_compute::Status
Status class.
Definition: Error.h:52
bias
const int32_t * bias
Definition: working_space.hpp:322
arm_compute::NEGEMMLowpOutputStage::~NEGEMMLowpOutputStage
~NEGEMMLowpOutputStage()
Default destructor.
arm_compute::NEGEMMLowpOutputStage::run
void run() override
Run the kernels contained in the function.
Definition: NEGEMMLowpOutputStage.cpp:74
arm_compute::NEGEMMLowpOutputStage::NEGEMMLowpOutputStage
NEGEMMLowpOutputStage()
Constructor.
Definition: NEGEMMLowpOutputStage.cpp:42
arm_compute::ACL_BIAS
@ ACL_BIAS
Definition: Types.h:74
arm_compute
Copyright (c) 2017-2023 Arm Limited.
Definition: introduction.dox:24
arm_compute::ACL_SRC
@ ACL_SRC
Definition: Types.h:44
arm_compute::ITensorInfo
Store the tensor's metadata.
Definition: ITensorInfo.h:44
ITensor.h
arm_compute::test::validation::info
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Validate.h
arm_compute::cpu::CpuGemmLowpOutputStage::validate
static Status validate(const ITensorInfo *src, const ITensorInfo *bias, const ITensorInfo *dst, const GEMMLowpOutputStageInfo &info)
Static function to check if given info will lead to a valid configuration.
Definition: CpuGemmLowpOutputStage.cpp:112
arm_compute::test::validation::input
auto input
Definition: LSTMLayerQuantized.cpp:486