MCPcopy Create free account
hub / github.com/ARM-software/armnn / CheckValidDataType

Function CheckValidDataType

src/armnnOnnxParser/OnnxParser.cpp:107–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105namespace
106{
107void 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, ...) \
130CheckValidDataType({__VA_ARGS__}, ACTUAL, #__VA_ARGS__, NODE, TENSOR, CHECK_LOCATION())

Callers 1

ValidateInputsMethod · 0.85

Calls 5

ParseExceptionClass · 0.85
formatEnum · 0.85
beginMethod · 0.45
endMethod · 0.45
AsStringMethod · 0.45

Tested by

no test coverage detected