ArmNN
 25.11
Loading...
Searching...
No Matches
RefLogicalBinaryWorkload.cpp
Go to the documentation of this file.
1//
2// Copyright © 2020-2024 Arm Ltd and Contributors. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
7
8#include "Decoders.hpp"
10#include "Encoders.hpp"
11#include "RefWorkloadUtils.hpp"
12
13#include <Profiling.hpp>
14
15#include <armnn/TypesUtils.hpp>
16
17namespace armnn
18{
19
24
26{
27 Execute(m_Data.m_Inputs, m_Data.m_Outputs);
28}
29
30void RefLogicalBinaryWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
31{
32 ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefLogicalBinaryWorkload_Execute");
33
34 const TensorInfo& inputInfo0 = GetTensorInfo(inputs[0]);
35 const TensorInfo& inputInfo1 = GetTensorInfo(inputs[1]);
36 const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
37
38 const TensorShape& inShape0 = inputInfo0.GetShape();
39 const TensorShape& inShape1 = inputInfo1.GetShape();
40 const TensorShape& outShape = outputInfo.GetShape();
41
42 std::unique_ptr<Decoder<InType>> input0 = MakeDecoder<InType>(inputInfo0, inputs[0]->Map());
43 std::unique_ptr<Decoder<InType>> input1 = MakeDecoder<InType>(inputInfo1, inputs[1]->Map());
44 std::unique_ptr<Encoder<OutType>> output = MakeEncoder<OutType>(outputInfo, outputs[0]->Map());
45
48
50 {
52 {
53 AndFunction(inShape0, inShape1, outShape, *input0, *input1, *output);
54 break;
55 }
57 {
58 OrFunction(inShape0, inShape1, outShape, *input0, *input1, *output);
59 break;
60 }
61 default:
62 {
63 throw InvalidArgumentException(std::string("Unsupported Logical Binary operation") +
64 GetLogicalBinaryOperationAsCString(m_Data.m_Parameters.m_Operation), CHECK_LOCATION());
65 }
66 }
67}
68
69} // namespace armnn
#define CHECK_LOCATION()
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
RefBaseWorkload(const LogicalBinaryQueueDescriptor &descriptor, const WorkloadInfo &info)
RefLogicalBinaryWorkload(const LogicalBinaryQueueDescriptor &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)
constexpr char const * GetLogicalBinaryOperationAsCString(LogicalBinaryOperation operation)
armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches, unsigned int numberOfChannels, unsigned int height, unsigned int width, const armnn::DataLayout dataLayout, const armnn::DataType dataType)
LogicalBinaryOperation m_Operation
Specifies the logical operation to execute.
Contains information about TensorInfos of a layer.