blob: b7670f6f6eac161bff534d1ed02e6fd16fe2bebd (
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
42
43
44
45
|
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "RefTensorHandle.hpp"
namespace armnn
{
RefTensorHandle::RefTensorHandle(const TensorInfo &tensorInfo):
m_TensorInfo(tensorInfo),
m_Memory(nullptr)
{
}
RefTensorHandle::~RefTensorHandle()
{
::operator delete(m_Memory);
}
void RefTensorHandle::Allocate()
{
if (m_Memory == nullptr)
{
m_Memory = ::operator new(m_TensorInfo.GetNumBytes());
}
else
{
throw InvalidArgumentException("RefTensorHandle::Allocate Trying to allocate a RefTensorHandle"
"that already has allocated memory.");
}
}
void RefTensorHandle::CopyOutTo(void* memory) const
{
memcpy(memory, m_Memory, m_TensorInfo.GetNumBytes());
}
void RefTensorHandle::CopyInFrom(const void* memory)
{
memcpy(m_Memory, memory, m_TensorInfo.GetNumBytes());
}
}
|