| 105 | namespace |
| 106 | { |
| 107 | void CheckValidDataType(std::initializer_list<onnx::TensorProto::DataType> validInputTypes, |
| 108 | const onnx::TensorProto::DataType actualValue, |
| 109 | const char* validExpr, |
| 110 | std::string nodeName, |
| 111 | std::string tensorName, |
| 112 | const armnn::CheckLocation& location) |
| 113 | { |
| 114 | bool isValid = std::any_of(validInputTypes.begin(), |
| 115 | validInputTypes.end(), |
| 116 | [&actualValue](onnx::TensorProto::DataType x) { return x == actualValue; } ); |
| 117 | if (!isValid) |
| 118 | { |
| 119 | throw ParseException( |
| 120 | fmt::format("Datatype {} is not valid for tensor '{}' of node '{}', not in {{{}}}. {}", |
| 121 | onnx::TensorProto::DataType_Name(actualValue), |
| 122 | tensorName, |
| 123 | nodeName, |
| 124 | validExpr, |
| 125 | location.AsString())); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | #define CHECK_VALID_DATATYPE(NODE, TENSOR, ACTUAL, ...) \ |
| 130 | CheckValidDataType({__VA_ARGS__}, ACTUAL, #__VA_ARGS__, NODE, TENSOR, CHECK_LOCATION()) |
no test coverage detected