ArmNN
 25.11
Loading...
Searching...
No Matches
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
13namespace armnn
14{
15
16struct RefShapeWorkload : public RefBaseWorkload<ShapeQueueDescriptor>
17{
18public:
20 virtual void Execute() const override
21 {
22 Execute(m_Data.m_Inputs, m_Data.m_Outputs);
23 }
24
25private:
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.
RefBaseWorkload(const ShapeQueueDescriptor &descriptor, const WorkloadInfo &info)
const TensorShape & GetShape() const
Definition Tensor.hpp:193
unsigned int GetNumDimensions() const
Definition Tensor.hpp:197
DataType GetDataType() const
Definition Tensor.hpp:200
Copyright (c) 2021 ARM Limited and Contributors.
constexpr unsigned int GetDataTypeSize(DataType dataType)
armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches, unsigned int numberOfChannels, unsigned int height, unsigned int width, const armnn::DataLayout dataLayout, const armnn::DataType dataType)
virtual void Execute() const override