ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RefShapeWorkload.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2021-2024 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include "RefBaseWorkload.hpp"
10 
11 #include "RefWorkloadUtils.hpp"
12 
13 namespace armnn
14 {
15 
16 struct RefShapeWorkload : public RefBaseWorkload<ShapeQueueDescriptor>
17 {
18 public:
20  virtual void Execute() const override
21  {
23  }
24 
25 private:
26  void Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
27  {
28  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefShapeWorkload_Execute");
29 
30  const TensorShape Shape = GetTensorInfo(inputs[0]).GetShape();
31 
32  const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
33 
34  unsigned int numBytes =
35  GetTensorInfo(inputs[0]).GetNumDimensions() * GetDataTypeSize(outputInfo.GetDataType());
36 
37  std::memcpy(outputs[0]->Map(), &Shape, numBytes);
38  outputs[0]->Unmap();
39  }
40 };
41 
42 } //namespace armnn
43 
44 
45 
46 
#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
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:197
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
DataType GetDataType() const
Definition: Tensor.hpp:200
Copyright (c) 2021 ARM Limited and Contributors.
constexpr unsigned int GetDataTypeSize(DataType dataType)
Definition: TypesUtils.hpp:183
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
std::vector< ITensorHandle * > m_Inputs
std::vector< ITensorHandle * > m_Outputs
virtual void Execute() const override