diff options
Diffstat (limited to 'src/backends/reference/workloads/Decoders.hpp')
-rw-r--r-- | src/backends/reference/workloads/Decoders.hpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/backends/reference/workloads/Decoders.hpp b/src/backends/reference/workloads/Decoders.hpp new file mode 100644 index 0000000000..4112e7d454 --- /dev/null +++ b/src/backends/reference/workloads/Decoders.hpp @@ -0,0 +1,48 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include "BaseIterator.hpp" + +namespace armnn +{ + +template<typename T> +std::unique_ptr<Decoder<T>> MakeDecoder(const TensorInfo& info, const void* data); + +template<> +std::unique_ptr<Decoder<float>> MakeDecoder(const TensorInfo& info, const void* data) +{ + switch(info.GetDataType()) + { + case armnn::DataType::QuantisedAsymm8: + { + return std::make_unique<QASymm8Decoder>( + static_cast<const uint8_t*>(data), + info.GetQuantizationScale(), + info.GetQuantizationOffset()); + } + case armnn::DataType::QuantisedSymm16: + { + return std::make_unique<QSymm16Decoder>( + static_cast<const int16_t*>(data), + info.GetQuantizationScale(), + info.GetQuantizationOffset()); + } + case armnn::DataType::Float32: + { + return std::make_unique<FloatDecoder>(static_cast<const float*>(data)); + } + default: + { + BOOST_ASSERT_MSG(false, "Not supported Data Type!"); + break; + } + } + return nullptr; +} + +} //namespace armnn
\ No newline at end of file |