xref: /aosp_15_r20/external/armnn/src/armnnUtils/VerificationHelpers.hpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2017,2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <iostream>
7 #include <sstream>
8 #include <cstdint>
9 #include <armnn/Exceptions.hpp>
10 
11 namespace armnnUtils
12 {
13 
14 void CheckValidSize(std::initializer_list<size_t> validInputCounts,
15                     size_t actualValue,
16                     const char* validExpr,
17                     const char* actualExpr,
18                     const armnn::CheckLocation& location);
19 
20 uint32_t NonNegative(const char* expr,
21                      int32_t value,
22                      const armnn::CheckLocation& location);
23 
24 int32_t VerifyInt32(const char* expr,
25                     int64_t value,
26                     const armnn::CheckLocation& location);
27 
28 }//armnnUtils
29 
30 #define CHECKED_INT32(VALUE) armnnUtils::VerifyInt32(#VALUE, VALUE, CHECK_LOCATION())
31 
32 #define CHECK_VALID_SIZE(ACTUAL, ...) \
33 armnnUtils::CheckValidSize({__VA_ARGS__}, ACTUAL, #__VA_ARGS__, #ACTUAL, CHECK_LOCATION())
34 
35 #define CHECKED_NON_NEGATIVE(VALUE) armnnUtils::NonNegative(#VALUE, VALUE, CHECK_LOCATION())
36