Laurent Carlier | 749294b | 2020-06-01 09:03:17 +0100 | [diff] [blame] | 1 | // |
Matthew Sloyan | 21a6a1a | 2022-06-30 17:13:04 +0100 | [diff] [blame] | 2 | // Copyright © 2022 Arm Ltd and Contributors. All rights reserved. |
Kevin May | 09ca49c | 2019-10-09 12:37:34 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "RefInstanceNormalizationWorkload.hpp" |
| 7 | |
| 8 | #include "InstanceNorm.hpp" |
| 9 | #include "RefWorkloadUtils.hpp" |
| 10 | |
| 11 | #include "Profiling.hpp" |
| 12 | |
| 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | RefInstanceNormalizationWorkload::RefInstanceNormalizationWorkload( |
| 17 | const InstanceNormalizationQueueDescriptor& descriptor, |
| 18 | const WorkloadInfo& info) |
Finn Williams | 73c547d | 2022-02-15 20:47:34 +0000 | [diff] [blame] | 19 | : RefBaseWorkload<InstanceNormalizationQueueDescriptor>(descriptor, info) {} |
Kevin May | 09ca49c | 2019-10-09 12:37:34 +0100 | [diff] [blame] | 20 | |
| 21 | void RefInstanceNormalizationWorkload::Execute() const |
| 22 | { |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 23 | Execute(m_Data.m_Inputs, m_Data.m_Outputs); |
| 24 | } |
| 25 | |
Matthew Sloyan | 21a6a1a | 2022-06-30 17:13:04 +0100 | [diff] [blame] | 26 | void RefInstanceNormalizationWorkload::ExecuteAsync(ExecutionData& executionData) |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 27 | { |
Matthew Sloyan | 21a6a1a | 2022-06-30 17:13:04 +0100 | [diff] [blame] | 28 | WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data); |
| 29 | Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs); |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | void RefInstanceNormalizationWorkload::Execute(std::vector<ITensorHandle*> inputs, |
| 33 | std::vector<ITensorHandle*> outputs) const |
| 34 | { |
Kevin May | 09ca49c | 2019-10-09 12:37:34 +0100 | [diff] [blame] | 35 | ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefInstanceNormalizationWorkload_Execute"); |
| 36 | |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 37 | std::unique_ptr<Decoder<float>> inputDecoder = MakeDecoder<float>(GetTensorInfo(inputs[0]), |
| 38 | inputs[0]->Map()); |
| 39 | std::unique_ptr<Encoder<float>> outputEncoder = MakeEncoder<float>(GetTensorInfo(outputs[0]), |
| 40 | outputs[0]->Map()); |
Finn Williams | 0109794 | 2021-04-26 12:06:34 +0100 | [diff] [blame] | 41 | const TensorInfo& inputInfo = GetTensorInfo(inputs[0]); |
Kevin May | 09ca49c | 2019-10-09 12:37:34 +0100 | [diff] [blame] | 42 | |
Finn Williams | 0109794 | 2021-04-26 12:06:34 +0100 | [diff] [blame] | 43 | InstanceNorm(m_Data, inputInfo, *inputDecoder, *outputEncoder); |
Kevin May | 09ca49c | 2019-10-09 12:37:34 +0100 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | } // namespace armnn |