2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
6 #include "VerificationHelpers.hpp"
7 #include <boost/format.hpp>
8 #include <armnn/Exceptions.hpp>
10 using namespace armnn;
15 void CheckValidSize(std::initializer_list<size_t> validInputCounts,
17 const char* validExpr,
18 const char* actualExpr,
19 const CheckLocation& location)
21 bool isValid = std::any_of(validInputCounts.begin(),
22 validInputCounts.end(),
23 [&actualValue](size_t x) { return x == actualValue; } );
28 boost::format("%1% = %2% is not valid, not in {%3%}. %4%") %
32 location.AsString()));
36 uint32_t NonNegative(const char* expr,
38 const CheckLocation& location)
44 boost::format("'%1%' must be non-negative, received: %2% at %3%") %
47 location.AsString() ));
51 return static_cast<uint32_t>(value);
55 int32_t VerifyInt32(const char* expr,
57 const armnn::CheckLocation& location)
59 if (value < std::numeric_limits<int>::min() || value > std::numeric_limits<int>::max())
63 boost::format("'%1%' must should fit into a int32 (ArmNN don't support int64), received: %2% at %3%") %
66 location.AsString() ));
70 return static_cast<int32_t>(value);