diff options
author | surmeh01 <surabhi.mehta@arm.com> | 2018-05-18 16:31:43 +0100 |
---|---|---|
committer | telsoa01 <telmo.soares@arm.com> | 2018-05-23 13:09:07 +0100 |
commit | 3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0 (patch) | |
tree | 5950603ad78ec3fe56fb31ddc7f4d52a19f5bc60 /include/armnn | |
parent | bceff2fb3fc68bb0aa88b886900c34b77340c826 (diff) | |
download | armnn-3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0.tar.gz |
Release 18.05
Diffstat (limited to 'include/armnn')
-rw-r--r-- | include/armnn/Exceptions.hpp | 19 | ||||
-rw-r--r-- | include/armnn/LayerSupport.hpp | 2 | ||||
-rw-r--r-- | include/armnn/TypesUtils.hpp | 24 | ||||
-rw-r--r-- | include/armnn/Version.hpp | 2 |
4 files changed, 44 insertions, 3 deletions
diff --git a/include/armnn/Exceptions.hpp b/include/armnn/Exceptions.hpp index 0b043997c4..630c77660d 100644 --- a/include/armnn/Exceptions.hpp +++ b/include/armnn/Exceptions.hpp @@ -6,6 +6,7 @@ #include <stdexcept> #include <string> +#include <sstream> namespace armnn { @@ -72,4 +73,22 @@ void ConditionalThrow(bool condition, const std::string& message) } } +/// +/// ComparedType must support: +/// operator==(const ComparedType&) +/// operator<<(ostream&, const ComparedType&) +/// +template <typename ExceptionType, typename ComparedType> +void ConditionalThrowIfNotEqual(const std::string& message, + const ComparedType& leftHandSide, + const ComparedType& rightHandSide) +{ + if (!(leftHandSide == rightHandSide)) + { + std::stringstream ss; + ss << message << " : " << leftHandSide << " != " << rightHandSide; + throw ExceptionType(ss.str()); + } +} + } diff --git a/include/armnn/LayerSupport.hpp b/include/armnn/LayerSupport.hpp index d9de76f89c..43a5756e4a 100644 --- a/include/armnn/LayerSupport.hpp +++ b/include/armnn/LayerSupport.hpp @@ -37,8 +37,10 @@ bool IsConstantSupported(Compute compute, bool IsConvolution2dSupported(Compute compute, const TensorInfo& input, + const TensorInfo& output, const Convolution2dDescriptor& descriptor, const TensorInfo& weights, + const TensorInfo& biases, char* reasonIfUnsupported = nullptr, size_t reasonIfUnsupportedMaxLength = 1024); diff --git a/include/armnn/TypesUtils.hpp b/include/armnn/TypesUtils.hpp index ba18e0045b..c63b653ae3 100644 --- a/include/armnn/TypesUtils.hpp +++ b/include/armnn/TypesUtils.hpp @@ -5,6 +5,7 @@ #pragma once #include "Types.hpp" +#include "Tensor.hpp" #include <cmath> #include <ostream> #include <boost/assert.hpp> @@ -196,6 +197,21 @@ inline std::ostream& operator<<(std::ostream& os, Compute compute) return os; } +inline std::ostream & operator<<(std::ostream & os, const armnn::TensorShape & shape) +{ + os << "["; + for (uint32_t i=0; i<shape.GetNumDimensions(); ++i) + { + if (i!=0) + { + os << ","; + } + os << shape[i]; + } + os << "]"; + return os; +} + /// Quantize a floating point data type into an 8-bit data type /// @param value The value to quantize /// @param scale The scale (must be non-zero) @@ -210,7 +226,11 @@ inline QuantizedType Quantize(float value, float scale, int32_t offset) constexpr QuantizedType min = std::numeric_limits<QuantizedType>::lowest(); BOOST_ASSERT(scale != 0.f); int quantized = boost::numeric_cast<int>(round(value / scale)) + offset; - QuantizedType quantizedBits = quantized < min ? min : quantized > max ? max : static_cast<QuantizedType>(quantized); + QuantizedType quantizedBits = quantized <= min + ? min + : quantized >= max + ? max + : static_cast<QuantizedType>(quantized); return quantizedBits; } @@ -229,4 +249,4 @@ inline float Dequantize(QuantizedType value, float scale, int32_t offset) return dequantized; } -} //namespace armnn
\ No newline at end of file +} //namespace armnn diff --git a/include/armnn/Version.hpp b/include/armnn/Version.hpp index 5fdcf8dbc6..ec99335530 100644 --- a/include/armnn/Version.hpp +++ b/include/armnn/Version.hpp @@ -9,4 +9,4 @@ // YYYY = 4-digit year number // MM = 2-digit month number // PP = 2-digit patch number -#define ARMNN_VERSION "20180300" +#define ARMNN_VERSION "20180500" |