diff options
author | Francis Murtagh <francis.murtagh@arm.com> | 2022-08-12 13:54:17 +0100 |
---|---|---|
committer | Nikhil Raj <nikhil.raj@arm.com> | 2022-09-07 14:08:58 +0100 |
commit | 9270d9e52fc1d946cf543c11df71bcc1f7b38544 (patch) | |
tree | 4b763ed4d200f76e170462a1b84a476d1c73a648 /src/backends/tosaReference/TosaRefTensorHandleFactory.cpp | |
parent | ce8204a528b3973b2dbf258095ab048a061263ea (diff) | |
download | armnn-9270d9e52fc1d946cf543c11df71bcc1f7b38544.tar.gz |
IVGCVSW-7159 Implement simple TOSA Reference Backend skeleton
* Added files based on RefBackend
* Added PreCompiled Workload skeleton
* Increment ABI version of armnnTestUtils for CreateInput which had
been left as pure virtual, added base implementation for it.
* Add IsTosaLayerSupported() for Addition
Change-Id: I4c963adf3f50593d17ecdf21554502a64ad3bd76
Diffstat (limited to 'src/backends/tosaReference/TosaRefTensorHandleFactory.cpp')
-rw-r--r-- | src/backends/tosaReference/TosaRefTensorHandleFactory.cpp | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/src/backends/tosaReference/TosaRefTensorHandleFactory.cpp b/src/backends/tosaReference/TosaRefTensorHandleFactory.cpp new file mode 100644 index 0000000000..62ada6fdf8 --- /dev/null +++ b/src/backends/tosaReference/TosaRefTensorHandleFactory.cpp @@ -0,0 +1,91 @@ +// +// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "TosaRefTensorHandleFactory.hpp" +#include "TosaRefTensorHandle.hpp" + +#include <armnn/utility/IgnoreUnused.hpp> + +namespace armnn +{ + +using FactoryId = ITensorHandleFactory::FactoryId; + +const FactoryId& TosaRefTensorHandleFactory::GetIdStatic() +{ + static const FactoryId s_Id(TosaRefTensorHandleFactoryId()); + return s_Id; +} + +std::unique_ptr<ITensorHandle> TosaRefTensorHandleFactory::CreateSubTensorHandle(ITensorHandle& parent, + const TensorShape& subTensorShape, + const unsigned int* subTensorOrigin) + const +{ + IgnoreUnused(parent, subTensorShape, subTensorOrigin); + return nullptr; +} + +std::unique_ptr<ITensorHandle> TosaRefTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo) const +{ + return std::make_unique<TosaRefTensorHandle>(tensorInfo, m_MemoryManager); +} + +std::unique_ptr<ITensorHandle> TosaRefTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo, + DataLayout dataLayout) const +{ + IgnoreUnused(dataLayout); + return std::make_unique<TosaRefTensorHandle>(tensorInfo, m_MemoryManager); +} + +std::unique_ptr<ITensorHandle> TosaRefTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo, + const bool IsMemoryManaged) const +{ + if (IsMemoryManaged) + { + return std::make_unique<TosaRefTensorHandle>(tensorInfo, m_MemoryManager); + } + else + { + return std::make_unique<TosaRefTensorHandle>(tensorInfo, m_ImportFlags); + } +} + +std::unique_ptr<ITensorHandle> TosaRefTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo, + DataLayout dataLayout, + const bool IsMemoryManaged) const +{ + IgnoreUnused(dataLayout); + if (IsMemoryManaged) + { + return std::make_unique<TosaRefTensorHandle>(tensorInfo, m_MemoryManager); + } + else + { + return std::make_unique<TosaRefTensorHandle>(tensorInfo, m_ImportFlags); + } +} + +const FactoryId& TosaRefTensorHandleFactory::GetId() const +{ + return GetIdStatic(); +} + +bool TosaRefTensorHandleFactory::SupportsSubTensors() const +{ + return false; +} + +MemorySourceFlags TosaRefTensorHandleFactory::GetExportFlags() const +{ + return m_ExportFlags; +} + +MemorySourceFlags TosaRefTensorHandleFactory::GetImportFlags() const +{ + return m_ImportFlags; +} + +} // namespace armnn
\ No newline at end of file |