ArmNN
 25.11
Loading...
Searching...
No Matches
RefTransposeConvolution2dWorkload.cpp
Go to the documentation of this file.
1//
2// Copyright © 2019,2021-2024 Arm Ltd and Contributors. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
7
10
11#include <Profiling.hpp>
12
13namespace armnn
14{
15
19{
20 // set up weights decoder
21 m_Weights = std::make_unique<ScopedTensorHandle>(*(descriptor.m_Weight));
22 const TensorInfo& weightsInfo = m_Weights->GetTensorInfo();
23
24 m_WeightsDecoder = MakeDecoder<float>(weightsInfo, m_Weights->Map(true));
25 m_WeightsShape = weightsInfo.GetShape();
26
27 // set up biases decoder
28 if (descriptor.m_Parameters.m_BiasEnabled)
29 {
30 m_Biases = std::make_unique<ScopedTensorHandle>(*(descriptor.m_Bias));
31 const TensorInfo& biasesInfo = m_Biases->GetTensorInfo();
32 m_BiasesDecoder = MakeDecoder<float>(biasesInfo, m_Biases->Map(true));
33 }
34}
35
37{
38 Execute(m_Data.m_Inputs, m_Data.m_Outputs);
39}
40
41void RefTransposeConvolution2dWorkload::Execute(std::vector<ITensorHandle*> inputs,
42 std::vector<ITensorHandle*> outputs) const
43{
44 ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefTransposeConvolution2dWorkload_Execute");
45
46 const TensorInfo& inputInfo = GetTensorInfo(inputs[0]);
47 const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
48
49 std::unique_ptr<Decoder<float>> inputDecoder = MakeDecoder<float>(inputInfo, inputs[0]->Map());
50 std::unique_ptr<Encoder<float>> outputEncoder = MakeEncoder<float>(outputInfo, outputs[0]->Map());
51
53 inputInfo.GetShape(),
54 *inputDecoder,
55 outputInfo.GetShape(),
56 *outputEncoder,
57 m_WeightsShape,
58 *m_WeightsDecoder,
59 m_BiasesDecoder.get());
60}
61
62} // namespace armnn
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
RefBaseWorkload(const TransposeConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info)
RefTransposeConvolution2dWorkload(const TransposeConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info)
const TensorShape & GetShape() const
Definition Tensor.hpp:193
Copyright (c) 2021 ARM Limited and Contributors.
std::unique_ptr< Decoder< T > > MakeDecoder(const TensorInfo &info, const void *data=nullptr)
std::unique_ptr< Encoder< T > > MakeEncoder(const TensorInfo &info, void *data=nullptr)
void TransposeConvolution2dImpl(const TransposeConvolution2dDescriptor &descriptor, const TensorShape &inputShape, Decoder< float > &inputDecoder, const TensorShape &outputShape, Encoder< float > &outputEncoder, const TensorShape &weightsShape, Decoder< float > &weightsDecoder, Decoder< float > *biasesDecoder)
armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches, unsigned int numberOfChannels, unsigned int height, unsigned int width, const armnn::DataLayout dataLayout, const armnn::DataType dataType)
Contains information about TensorInfos of a layer.