aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference/workloads/RefConstantWorkload.cpp
blob: 3506198410deca5f87933de4ced5db56dfacdb5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "RefConstantWorkload.hpp"

#include "RefWorkloadUtils.hpp"

#include <armnn/Types.hpp>

#include <boost/assert.hpp>

#include <cstring>

namespace armnn
{

RefConstantWorkload::RefConstantWorkload(
    const ConstantQueueDescriptor& descriptor, const WorkloadInfo& info)
    : BaseWorkload<ConstantQueueDescriptor>(descriptor, info) {}

void RefConstantWorkload::PostAllocationConfigure()
{
    const ConstantQueueDescriptor& data = this->m_Data;

    BOOST_ASSERT(data.m_LayerOutput != nullptr);

    const TensorInfo& outputInfo = GetTensorInfo(data.m_Outputs[0]);
    BOOST_ASSERT(data.m_LayerOutput->GetTensorInfo().GetNumBytes() == outputInfo.GetNumBytes());

    memcpy(GetOutputTensorData<void>(0, data), data.m_LayerOutput->GetConstTensor<void>(),
        outputInfo.GetNumBytes());
}

void RefConstantWorkload::Execute() const
{
    ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefConstantWorkload_Execute");
}

} //namespace armnn