ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
17 namespace armnn
18 {
19 
21  const WorkloadInfo& info)
23 {}
24 
26 {
28 }
29 
30 void 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 
49  switch (m_Data.m_Parameters.m_Operation)
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()
Definition: Exceptions.hpp:203
#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
RefLogicalBinaryWorkload(const LogicalBinaryQueueDescriptor &descriptor, const WorkloadInfo &info)
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
Copyright (c) 2021 ARM Limited and Contributors.
constexpr char const * GetLogicalBinaryOperationAsCString(LogicalBinaryOperation operation)
Definition: TypesUtils.hpp:110
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
std::vector< ITensorHandle * > m_Inputs
std::vector< ITensorHandle * > m_Outputs
Contains information about TensorInfos of a layer.