ArmNN
 21.11
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 {
28 }
29 
31 {
32  Execute(workingMemDescriptor.m_Inputs, workingMemDescriptor.m_Outputs);
33 }
34 
35 void RefLogicalBinaryWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
36 {
37  ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefLogicalBinaryWorkload_Execute");
38 
39  const TensorInfo& inputInfo0 = GetTensorInfo(inputs[0]);
40  const TensorInfo& inputInfo1 = GetTensorInfo(inputs[1]);
41  const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
42 
43  const TensorShape& inShape0 = inputInfo0.GetShape();
44  const TensorShape& inShape1 = inputInfo1.GetShape();
45  const TensorShape& outShape = outputInfo.GetShape();
46 
47  std::unique_ptr<Decoder<InType>> input0 = MakeDecoder<InType>(inputInfo0, inputs[0]->Map());
48  std::unique_ptr<Decoder<InType>> input1 = MakeDecoder<InType>(inputInfo1, inputs[1]->Map());
49  std::unique_ptr<Encoder<OutType>> output = MakeEncoder<OutType>(outputInfo, outputs[0]->Map());
50 
53 
55  {
57  {
58  AndFunction(inShape0, inShape1, outShape, *input0, *input1, *output);
59  break;
60  }
62  {
63  OrFunction(inShape0, inShape1, outShape, *input0, *input1, *output);
64  break;
65  }
66  default:
67  {
68  throw InvalidArgumentException(std::string("Unsupported Logical Binary operation") +
70  }
71  }
72 }
73 
74 } // namespace armnn
const TensorShape & GetShape() const
Definition: Tensor.hpp:191
CPU Execution: Reference C++ kernels.
void ExecuteAsync(WorkingMemDescriptor &workingMemDescriptor) override
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:220
constexpr char const * GetLogicalBinaryOperationAsCString(LogicalBinaryOperation operation)
Definition: TypesUtils.hpp:87
#define CHECK_LOCATION()
Definition: Exceptions.hpp:209
std::vector< ITensorHandle * > m_Outputs
Contains information about TensorInfos of a layer.
RefLogicalBinaryWorkload(const LogicalBinaryQueueDescriptor &descriptor, const WorkloadInfo &info)
std::vector< ITensorHandle * > m_Inputs
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers