ArmNN
 24.02
RefLogicalBinaryWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020-2023 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 
31 {
32  WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
33  Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs);
34 }
35 
36 void RefLogicalBinaryWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
37 {
38  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefLogicalBinaryWorkload_Execute");
39 
40  const TensorInfo& inputInfo0 = GetTensorInfo(inputs[0]);
41  const TensorInfo& inputInfo1 = GetTensorInfo(inputs[1]);
42  const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
43 
44  const TensorShape& inShape0 = inputInfo0.GetShape();
45  const TensorShape& inShape1 = inputInfo1.GetShape();
46  const TensorShape& outShape = outputInfo.GetShape();
47 
48  std::unique_ptr<Decoder<InType>> input0 = MakeDecoder<InType>(inputInfo0, inputs[0]->Map());
49  std::unique_ptr<Decoder<InType>> input1 = MakeDecoder<InType>(inputInfo1, inputs[1]->Map());
50  std::unique_ptr<Encoder<OutType>> output = MakeEncoder<OutType>(outputInfo, outputs[0]->Map());
51 
54 
56  {
58  {
59  AndFunction(inShape0, inShape1, outShape, *input0, *input1, *output);
60  break;
61  }
63  {
64  OrFunction(inShape0, inShape1, outShape, *input0, *input1, *output);
65  break;
66  }
67  default:
68  {
69  throw InvalidArgumentException(std::string("Unsupported Logical Binary operation") +
71  }
72  }
73 }
74 
75 } // namespace armnn
armnn::RefLogicalBinaryWorkload::ExecuteAsync
void ExecuteAsync(ExecutionData &executionData) override
Definition: RefLogicalBinaryWorkload.cpp:30
armnn::GetLogicalBinaryOperationAsCString
constexpr char const * GetLogicalBinaryOperationAsCString(LogicalBinaryOperation operation)
Definition: TypesUtils.hpp:109
armnn::LogicalBinaryFunction
Definition: ElementwiseFunction.hpp:41
armnn::experimental::ExecutionData::m_Data
void * m_Data
Definition: ExecutionData.hpp:16
TypesUtils.hpp
armnn::TensorInfo
Definition: Tensor.hpp:152
CHECK_LOCATION
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
Profiling.hpp
armnn::LogicalBinaryOperation::LogicalOr
@ LogicalOr
armnn::LogicalBinaryQueueDescriptor
Definition: WorkloadData.hpp:681
ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: RefWorkloadUtils.hpp:22
armnn::TensorShape
Definition: Tensor.hpp:20
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::LogicalBinaryDescriptor::m_Operation
LogicalBinaryOperation m_Operation
Specifies the logical operation to execute.
Definition: Descriptors.hpp:1534
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
armnn::GetTensorInfo
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
Definition: RefWorkloadUtils.hpp:33
armnn::RefLogicalBinaryWorkload::Execute
void Execute() const override
Definition: RefLogicalBinaryWorkload.cpp:25
armnn::BoostLogSeverityMapping::info
@ info
armnn::RefLogicalBinaryWorkload::RefLogicalBinaryWorkload
RefLogicalBinaryWorkload(const LogicalBinaryQueueDescriptor &descriptor, const WorkloadInfo &info)
Definition: RefLogicalBinaryWorkload.cpp:20
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
RefLogicalBinaryWorkload.hpp
armnn::LogicalBinaryOperation::LogicalAnd
@ LogicalAnd
RefWorkloadUtils.hpp
armnn::BaseWorkload< LogicalBinaryQueueDescriptor >::m_Data
LogicalBinaryQueueDescriptor m_Data
Definition: Workload.hpp:89
armnn::TensorInfo::GetShape
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
ElementwiseFunction.hpp
Decoders.hpp
armnn::LayerType::Map
@ Map
armnn::experimental::WorkingMemDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkingMemDescriptor.hpp:20
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::experimental::WorkingMemDescriptor
Definition: WorkingMemDescriptor.hpp:18
Encoders.hpp
armnn::RefBaseWorkload
Definition: RefBaseWorkload.hpp:13
armnn::experimental::WorkingMemDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkingMemDescriptor.hpp:21
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26
armnn::experimental::ExecutionData
Definition: ExecutionData.hpp:14