blob: 45394da97fdfad4a00ec02663f5b3ee50492d246 [file] [log] [blame]
telsoa014fcda012018-03-09 14:13:49 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
telsoa014fcda012018-03-09 14:13:49 +00004//
5
6#pragma once
7
Aron Virginas-Tarc9cc8042018-11-01 16:15:57 +00008#include <backendsCommon/Workload.hpp>
telsoa014fcda012018-03-09 14:13:49 +00009
Matthew Bentham9b3e7382020-02-05 21:39:55 +000010#include <arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h>
Matthew Bentham14e46692018-09-20 15:35:30 +010011#include <arm_compute/runtime/MemoryManagerOnDemand.h>
surmeh013537c2c2018-05-18 16:31:43 +010012
13#include <memory>
telsoa014fcda012018-03-09 14:13:49 +000014
15namespace armnn
16{
17
telsoa01c577f2c2018-08-31 09:22:23 +010018arm_compute::Status ClFullyConnectedWorkloadValidate(const TensorInfo& input,
19 const TensorInfo& output,
20 const TensorInfo& weights,
21 const TensorInfo& biases,
Mike Kelly07810fc2020-11-12 10:58:48 +000022 const FullyConnectedDescriptor& descriptor,
23 const ActivationDescriptor* activationDescriptor = nullptr);
telsoa01c577f2c2018-08-31 09:22:23 +010024
Matthew Benthamab8cdc12018-09-17 11:17:41 +010025class ClFullyConnectedWorkload : public armnn::BaseWorkload<armnn::FullyConnectedQueueDescriptor>
telsoa014fcda012018-03-09 14:13:49 +000026{
27public:
Matthew Benthamab8cdc12018-09-17 11:17:41 +010028 ClFullyConnectedWorkload(const armnn::FullyConnectedQueueDescriptor& descriptor,
29 const armnn::WorkloadInfo& info,
Sadik Armagane9444752020-12-02 11:28:58 +000030 std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager,
31 const arm_compute::CLCompileContext& clCompileContext);
telsoa014fcda012018-03-09 14:13:49 +000032
Matthew Benthamab8cdc12018-09-17 11:17:41 +010033 using armnn::BaseWorkload<armnn::FullyConnectedQueueDescriptor>::m_Data;
telsoa014fcda012018-03-09 14:13:49 +000034 void Execute() const override;
35
36private:
telsoa01c577f2c2018-08-31 09:22:23 +010037 mutable arm_compute::CLFullyConnectedLayer m_FullyConnectedLayer;
38
39 std::unique_ptr<arm_compute::CLTensor> m_WeightsTensor;
40 std::unique_ptr<arm_compute::CLTensor> m_BiasesTensor;
41
42 void FreeUnusedTensors();
telsoa014fcda012018-03-09 14:13:49 +000043};
44
45} //namespace armnn