blob: 47c537cf841a5cb5652d0e570c589497a82af4f7 [file] [log] [blame]
Aron Virginas-Tare662a942019-10-14 15:12:00 +01001//
Mike Kelly7cbe7812023-07-25 17:37:33 +01002// Copyright © 2019-2023 Arm Ltd and Contributors. All rights reserved.
Aron Virginas-Tare662a942019-10-14 15:12:00 +01003// SPDX-License-Identifier: MIT
4//
5
6#include "RefLogSoftmaxWorkload.hpp"
7
8#include "Decoders.hpp"
9#include "Encoders.hpp"
10#include "LogSoftmax.hpp"
11#include "RefWorkloadUtils.hpp"
12
13#include <Profiling.hpp>
14
Aron Virginas-Tare662a942019-10-14 15:12:00 +010015namespace armnn
16{
17
18void RefLogSoftmaxWorkload::Execute() const
19{
Finn Williamsb8181f72021-04-07 10:23:21 +010020 Execute(m_Data.m_Inputs, m_Data.m_Outputs);
21}
22
Matthew Sloyan2d213a72022-06-30 17:13:04 +010023void RefLogSoftmaxWorkload::ExecuteAsync(ExecutionData& executionData)
Finn Williamsb8181f72021-04-07 10:23:21 +010024{
Matthew Sloyan2d213a72022-06-30 17:13:04 +010025 WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
26 Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs);
Finn Williamsb8181f72021-04-07 10:23:21 +010027}
28
29void RefLogSoftmaxWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
30{
Mike Kelly7cbe7812023-07-25 17:37:33 +010031 ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefLogSoftmaxWorkload_Execute");
Aron Virginas-Tare662a942019-10-14 15:12:00 +010032
Finn Williamsb8181f72021-04-07 10:23:21 +010033 const TensorInfo& inputInfo = GetTensorInfo(inputs[0]);
34 const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
Aron Virginas-Tare662a942019-10-14 15:12:00 +010035
Finn Williamsb8181f72021-04-07 10:23:21 +010036 std::unique_ptr<Decoder<float>> decoder = MakeDecoder<float>(inputInfo, inputs[0]->Map());
37 std::unique_ptr<Encoder<float>> encoder = MakeEncoder<float>(outputInfo, outputs[0]->Map());
Aron Virginas-Tare662a942019-10-14 15:12:00 +010038
Aron Virginas-Tare662a942019-10-14 15:12:00 +010039 LogSoftmax(*decoder, *encoder, inputInfo, m_Data.m_Parameters);
40}
41
42} // namespace armnn