blob: 311b59498b07f5dd28cd5a6d68400c48dcd55549 [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,
30 std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager);
telsoa014fcda012018-03-09 14:13:49 +000031
Matthew Benthamab8cdc12018-09-17 11:17:41 +010032 using armnn::BaseWorkload<armnn::FullyConnectedQueueDescriptor>::m_Data;
telsoa014fcda012018-03-09 14:13:49 +000033 void Execute() const override;
34
35private:
telsoa01c577f2c2018-08-31 09:22:23 +010036 mutable arm_compute::CLFullyConnectedLayer m_FullyConnectedLayer;
37
38 std::unique_ptr<arm_compute::CLTensor> m_WeightsTensor;
39 std::unique_ptr<arm_compute::CLTensor> m_BiasesTensor;
40
41 void FreeUnusedTensors();
telsoa014fcda012018-03-09 14:13:49 +000042};
43
44} //namespace armnn