ArmNN
 25.11
Loading...
Searching...
No Matches
RefBroadcastToWorkload.cpp
Go to the documentation of this file.
1//
2// Copyright © 2023-2024 Arm Ltd and Contributors. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
8#include "Profiling.hpp"
9#include "Broadcast.hpp"
10
11#include "Decoders.hpp"
12#include "Encoders.hpp"
13
14namespace armnn
15{
16
20
22{
23 Execute(m_Data.m_Inputs, m_Data.m_Outputs);
24}
25
26void RefBroadcastToWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
27{
28 ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefBroadcastToWorkload_Execute");
29 const TensorInfo& inputInfo = GetTensorInfo(inputs[0]);
30 const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
31
32 std::unique_ptr<Decoder<float>> input = MakeDecoder<float>(inputInfo, inputs[0]->Map());
33 std::unique_ptr<Encoder<float>> output= MakeEncoder<float>(outputInfo, outputs[0]->Map());
34
35 auto broadcastTo = [](float x)
36 {
37 return x;
38 };
39 BroadcastLoop(inputInfo.GetShape(), outputInfo.GetShape()).Unroll(broadcastTo,
40 0, *input, *output);
41}
42} // 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 BroadcastToQueueDescriptor &descriptor, const WorkloadInfo &info)
RefBroadcastToWorkload(const BroadcastToQueueDescriptor &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)
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.