ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
8 #include "RefWorkloadUtils.hpp"
10 
11 #include <Profiling.hpp>
12 
13 namespace armnn
14 {
15 
17  const TransposeConvolution2dQueueDescriptor& descriptor, const WorkloadInfo& info) :
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 {
39 }
40 
41 void 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.
QueueDescriptor m_Data
Definition: Workload.hpp:74
RefTransposeConvolution2dWorkload(const TransposeConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info)
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
Copyright (c) 2021 ARM Limited and Contributors.
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
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)
std::vector< ITensorHandle * > m_Inputs
std::vector< ITensorHandle * > m_Outputs
bool m_BiasEnabled
Enable/disable bias.
Contains information about TensorInfos of a layer.