Lines Matching refs:operand

74 static bool validateOperandExtraParams(const V1_2::Operand& operand, uint32_t index) {  in validateOperandExtraParams()  argument
75 switch (operand.type) { in validateOperandExtraParams()
88 NN_RET_CHECK(operand.extraParams.getDiscriminator() == in validateOperandExtraParams()
91 << getOperandTypeName(operand.type) in validateOperandExtraParams()
92 << " has incorrect extraParams: " << toString(operand.extraParams); in validateOperandExtraParams()
95 NN_RET_CHECK(operand.extraParams.getDiscriminator() == in validateOperandExtraParams()
98 << getOperandTypeName(operand.type) << " without a Channel Quantization params"; in validateOperandExtraParams()
99 auto& channelQuant = operand.extraParams.channelQuant(); in validateOperandExtraParams()
101 size_t count = operand.dimensions.size(); in validateOperandExtraParams()
104 << getOperandTypeName(operand.type) in validateOperandExtraParams()
107 uint32_t expected = operand.dimensions[channelQuant.channelDim]; in validateOperandExtraParams()
110 << getOperandTypeName(operand.type) << " with a wrong-sized scales, " in validateOperandExtraParams()
114 << getOperandTypeName(operand.type) << " channel dimension " in validateOperandExtraParams()
119 << getOperandTypeName(operand.type) << " with a negative value in scales[" in validateOperandExtraParams()
124 if (isExtensionOperandType(operand.type)) { in validateOperandExtraParams()
125 NN_RET_CHECK(operand.extraParams.getDiscriminator() == in validateOperandExtraParams()
127 operand.extraParams.getDiscriminator() == in validateOperandExtraParams()
130 << getOperandTypeName(operand.type) in validateOperandExtraParams()
131 << " has incorrect extraParams: " << toString(operand.extraParams); in validateOperandExtraParams()
153 V1_2::Operand operand = convertToV1_2(versionedOperand); in validateOperands() local
155 switch (operand.type) { in validateOperands()
162 size_t count = operand.dimensions.size(); in validateOperands()
180 if ((!allowUnspecifiedRank || operand.lifetime == OperandLifeTime::CONSTANT_COPY || in validateOperands()
181 operand.lifetime == OperandLifeTime::CONSTANT_REFERENCE) && in validateOperands()
182 operand.dimensions.size() == 0) { in validateOperands()
189 if (!isExtensionOperandType(operand.type)) { in validateOperands()
191 << toString(operand.type); in validateOperands()
203 switch (operand.type) { in validateOperands()
213 if (operand.scale != 0.f) { in validateOperands()
215 << getOperandTypeName(operand.type) << " with a non-zero scale (" in validateOperands()
216 << operand.scale << ")"; in validateOperands()
222 if (operand.scale < 0.f) { in validateOperands()
224 << getOperandTypeName(operand.type) << " with a negative scale"; in validateOperands()
232 if (operand.scale <= 0.f) { in validateOperands()
234 << getOperandTypeName(operand.type) << " with a non-positive scale"; in validateOperands()
239 if (isExtensionOperandType(operand.type) && operand.scale != 0.f) { in validateOperands()
241 << getOperandTypeName(operand.type) << " with a non-zero scale (" in validateOperands()
242 << operand.scale << ")"; in validateOperands()
251 switch (operand.type) { in validateOperands()
263 if (operand.zeroPoint != 0) { in validateOperands()
265 << getOperandTypeName(operand.type) << " with a non-zero zeroPoint " in validateOperands()
266 << operand.zeroPoint; in validateOperands()
271 if (operand.zeroPoint < 0 || operand.zeroPoint > 255) { in validateOperands()
273 << getOperandTypeName(operand.type) << " with an invalid zeroPoint " in validateOperands()
274 << operand.zeroPoint << ", must be in range [0, 255]"; in validateOperands()
279 if (operand.zeroPoint < 0 || operand.zeroPoint > 65535) { in validateOperands()
281 << getOperandTypeName(operand.type) << " with an invalid zeroPoint " in validateOperands()
282 << operand.zeroPoint << ", must be in range [0, 65535]"; in validateOperands()
287 if (operand.zeroPoint != 0) { in validateOperands()
289 << getOperandTypeName(operand.type) << " with a non-zero zeroPoint " in validateOperands()
290 << operand.zeroPoint; in validateOperands()
295 if (isExtensionOperandType(operand.type) && operand.zeroPoint != 0) { in validateOperands()
297 << getOperandTypeName(operand.type) << " with a non-zero zeroPoint " in validateOperands()
298 << operand.zeroPoint; in validateOperands()
305 NN_RET_CHECK(validateOperandExtraParams(operand, index)); in validateOperands()
308 const DataLocation& location = operand.location; in validateOperands()
309 switch (operand.lifetime) { in validateOperands()
339 << toString(operand.lifetime); in validateOperands()
345 << toString(operand.lifetime); in validateOperands()
351 if (operand.lifetime == OperandLifeTime::CONSTANT_REFERENCE || in validateOperands()
352 operand.lifetime == OperandLifeTime::CONSTANT_COPY) { in validateOperands()
353 if (!isExtensionOperandType(operand.type) && operand.type != OperandType::OEM && in validateOperands()
354 operand.type != OperandType::TENSOR_OEM_BYTE) { in validateOperands()
355 uint32_t expectedLength = nonExtensionOperandSizeOfData(operand); in validateOperands()
357 LOG(ERROR) << "Operand " << index << ": For operand " << toString(operand) in validateOperands()
403 const Operand& operand = operands[i]; in validateOperations() local
404 if (operand.lifetime != OperandLifeTime::TEMPORARY_VARIABLE && in validateOperations()
405 operand.lifetime != OperandLifeTime::MODEL_OUTPUT) { in validateOperations()
407 << toString(operand.lifetime); in validateOperations()
421 const Operand& operand = operands[i]; in validateOperations() local
422 if (operand.lifetime == OperandLifeTime::TEMPORARY_VARIABLE || in validateOperations()
423 operand.lifetime == OperandLifeTime::MODEL_OUTPUT) { in validateOperations()
424 LOG(ERROR) << "Operand " << i << " with lifetime " << toString(operand.lifetime) in validateOperations()
464 const Operand& operand = operands[i]; in validateModelInputOutputs() local
465 if (operand.lifetime != lifetime) { in validateModelInputOutputs()
466 LOG(ERROR) << "Model input or output has lifetime of " << toString(operand.lifetime) in validateModelInputOutputs()
531 const Operand& operand = operands[operandIndex]; in validateRequestArguments() local
549 for (size_t i = 0; i < operand.dimensions.size(); i++) { in validateRequestArguments()
550 if (operand.dimensions[i] == 0) { in validateRequestArguments()
558 if (rank != operand.dimensions.size()) { in validateRequestArguments()
561 << ") different than the model's (" << operand.dimensions.size() in validateRequestArguments()
566 if (requestArgument.dimensions[i] != operand.dimensions[i] && in validateRequestArguments()
567 operand.dimensions[i] != 0) { in validateRequestArguments()
571 << " different than the model's " << operand.dimensions[i]; in validateRequestArguments()