ArmNN
 21.02
RefLogicalBinaryWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 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 {
27  const TensorInfo& inputInfo0 = GetTensorInfo(m_Data.m_Inputs[0]);
28  const TensorInfo& inputInfo1 = GetTensorInfo(m_Data.m_Inputs[1]);
29  const TensorInfo& outputInfo = GetTensorInfo(m_Data.m_Outputs[0]);
30 
31  m_Input0 = MakeDecoder<InType>(inputInfo0);
32  m_Input1 = MakeDecoder<InType>(inputInfo1);
33  m_Output = MakeEncoder<OutType>(outputInfo);
34 }
35 
37 {
38  ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefLogicalBinaryWorkload_Execute");
39 
40  const TensorInfo& inputInfo0 = GetTensorInfo(m_Data.m_Inputs[0]);
41  const TensorInfo& inputInfo1 = GetTensorInfo(m_Data.m_Inputs[1]);
42  const TensorInfo& outputInfo = GetTensorInfo(m_Data.m_Outputs[0]);
43 
44  const TensorShape& inShape0 = inputInfo0.GetShape();
45  const TensorShape& inShape1 = inputInfo1.GetShape();
46  const TensorShape& outShape = outputInfo.GetShape();
47 
48  m_Input0->Reset(m_Data.m_Inputs[0]->Map());
49  m_Input1->Reset(m_Data.m_Inputs[1]->Map());
50  m_Output->Reset(m_Data.m_Outputs[0]->Map());
51 
54 
56  {
58  {
59  AndFunction(inShape0, inShape1, outShape, *m_Input0, *m_Input1, *m_Output);
60  break;
61  }
63  {
64  OrFunction(inShape0, inShape1, outShape, *m_Input0, *m_Input1, *m_Output);
65  break;
66  }
67  default:
68  {
69  throw InvalidArgumentException(std::string("Unsupported Logical Binary operation") +
71  }
72  }
73 }
74 
75 } // namespace armnn
const TensorShape & GetShape() const
Definition: Tensor.hpp:187
CPU Execution: Reference C++ kernels.
const LogicalBinaryQueueDescriptor m_Data
Definition: Workload.hpp:46
Copyright (c) 2021 ARM Limited and Contributors.
LogicalBinaryOperation m_Operation
Specifies the logical operation to execute.
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:173
constexpr char const * GetLogicalBinaryOperationAsCString(LogicalBinaryOperation operation)
Definition: TypesUtils.hpp:85
#define CHECK_LOCATION()
Definition: Exceptions.hpp:197
std::vector< ITensorHandle * > m_Outputs
virtual void Execute() const override
Contains information about inputs and outputs to a layer.
RefLogicalBinaryWorkload(const LogicalBinaryQueueDescriptor &descriptor, const WorkloadInfo &info)
std::vector< ITensorHandle * > m_Inputs
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers