blob: 3ab9f986a8f32675831ecf255e15acd9e0e03ddf [file] [log] [blame]
telsoa014fcda012018-03-09 14:13:49 +00001//
Teresa Charlin588cbdf2022-01-19 15:55:37 +00002// Copyright © 2017 Arm Ltd and Contributors. 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
Teresa Charlin588cbdf2022-01-19 15:55:37 +00008#include "ClBaseWorkload.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,
Matthew Bentham67d63902022-02-08 15:03:07 +000021 const Optional<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
Teresa Charlin588cbdf2022-01-19 15:55:37 +000025class ClFullyConnectedWorkload : public ClBaseWorkload<FullyConnectedQueueDescriptor>
telsoa014fcda012018-03-09 14:13:49 +000026{
27public:
Teresa Charlin588cbdf2022-01-19 15:55:37 +000028 ClFullyConnectedWorkload(const FullyConnectedQueueDescriptor& descriptor,
29 const 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
Teresa Charlin588cbdf2022-01-19 15:55:37 +000033 using ClBaseWorkload<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