aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/backends/CpuTensorHandle.cpp
diff options
context:
space:
mode:
authorDavid Beck <david.beck@arm.com>2018-09-19 12:03:20 +0100
committerMatthew Bentham <matthew.bentham@arm.com>2018-10-10 16:16:56 +0100
commit10b4dfd8e9ccd7a03df7bb053ee1c644cb37f8ab (patch)
tree1ac5b4f415531e2ef759439ab8e113f177bea7c5 /src/armnn/backends/CpuTensorHandle.cpp
parenta3f165624b2cdfbced674af5a6e11856b1e746d9 (diff)
downloadarmnn-10b4dfd8e9ccd7a03df7bb053ee1c644cb37f8ab.tar.gz
IVGCVSW-1897 : build infrastructure for the src/backends folder
Change-Id: I7ebafb675ccc77ad54d1deb01412a8379a5356bb
Diffstat (limited to 'src/armnn/backends/CpuTensorHandle.cpp')
-rw-r--r--src/armnn/backends/CpuTensorHandle.cpp113
1 files changed, 0 insertions, 113 deletions
diff --git a/src/armnn/backends/CpuTensorHandle.cpp b/src/armnn/backends/CpuTensorHandle.cpp
deleted file mode 100644
index 1a264531e5..0000000000
--- a/src/armnn/backends/CpuTensorHandle.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "armnn/Exceptions.hpp"
-#include "CpuTensorHandle.hpp"
-
-#include <cstring>
-
-namespace armnn
-{
-
-ConstCpuTensorHandle::ConstCpuTensorHandle(const TensorInfo& tensorInfo)
-: m_TensorInfo(tensorInfo)
-, m_Memory(nullptr)
-{
-}
-
-template <>
-const void* ConstCpuTensorHandle::GetConstTensor() const
-{
- return m_Memory;
-}
-
-CpuTensorHandle::CpuTensorHandle(const TensorInfo& tensorInfo)
-: ConstCpuTensorHandle(tensorInfo)
-, m_MutableMemory(nullptr)
-{
-}
-
-template <>
-void* CpuTensorHandle::GetTensor() const
-{
- return m_MutableMemory;
-}
-
-ScopedCpuTensorHandle::ScopedCpuTensorHandle(const TensorInfo& tensorInfo)
-: CpuTensorHandle(tensorInfo)
-{
-}
-
-ScopedCpuTensorHandle::ScopedCpuTensorHandle(const ConstTensor& tensor)
-: ScopedCpuTensorHandle(tensor.GetInfo())
-{
- CopyFrom(tensor.GetMemoryArea(), tensor.GetNumBytes());
-}
-
-ScopedCpuTensorHandle::ScopedCpuTensorHandle(const ConstCpuTensorHandle& tensorHandle)
-: ScopedCpuTensorHandle(tensorHandle.GetTensorInfo())
-{
- CopyFrom(tensorHandle.GetConstTensor<void>(), tensorHandle.GetTensorInfo().GetNumBytes());
-}
-
-ScopedCpuTensorHandle::ScopedCpuTensorHandle(const ScopedCpuTensorHandle& other)
-: CpuTensorHandle(other.GetTensorInfo())
-{
- CopyFrom(other);
-}
-
-ScopedCpuTensorHandle& ScopedCpuTensorHandle::operator=(const ScopedCpuTensorHandle& other)
-{
- ::operator delete(GetTensor<void>());
- SetMemory(nullptr);
- CopyFrom(other);
- return *this;
-}
-
-ScopedCpuTensorHandle::~ScopedCpuTensorHandle()
-{
- ::operator delete(GetTensor<void>());
-}
-
-void ScopedCpuTensorHandle::Allocate()
-{
- if (GetTensor<void>() == nullptr)
- {
- SetMemory(::operator new(GetTensorInfo().GetNumBytes()));
- }
- else
- {
- throw InvalidArgumentException("CpuTensorHandle::Allocate Trying to allocate a CpuTensorHandle"
- "that already has allocated memory.");
- }
-}
-
-void ScopedCpuTensorHandle::CopyFrom(const ScopedCpuTensorHandle& other)
-{
- CopyFrom(other.GetTensor<void>(), other.GetTensorInfo().GetNumBytes());
-}
-
-void ScopedCpuTensorHandle::CopyFrom(const void* srcMemory, unsigned int numBytes)
-{
- BOOST_ASSERT(GetTensor<void>() == nullptr);
- BOOST_ASSERT(GetTensorInfo().GetNumBytes() == numBytes);
-
- if (srcMemory)
- {
- Allocate();
- memcpy(GetTensor<void>(), srcMemory, numBytes);
- }
-}
-
-void PassthroughCpuTensorHandle::Allocate()
-{
- throw InvalidArgumentException("PassthroughCpuTensorHandle::Allocate() should never be called");
-}
-
-void ConstPassthroughCpuTensorHandle::Allocate()
-{
- throw InvalidArgumentException("ConstPassthroughCpuTensorHandle::Allocate() should never be called");
-}
-
-} // namespace armnn