20 #include <fmt/format.h>
30 switch (inputDataType)
32 case DataType::Float16:
33 return DataType::Float16;
35 case DataType::Float32:
36 return DataType::Float32;
37 case DataType::QAsymmS8:
38 case DataType::QAsymmU8:
39 case DataType::QSymmS8:
40 case DataType::QSymmS16:
41 return DataType::Signed32;
53 std::string to_string(T value)
55 std::ostringstream os;
61 void ValidatePointer(
const void* ptr, std::string
const& descName, std::string
const& paramName)
66 paramName +
" parameter must be set.");
71 void ValidateTensorShapesMatch(
const TensorInfo& first,
73 std::string
const& descName,
74 std::string
const& firstName,
75 std::string
const& secondName)
80 + firstName +
" & " + secondName +
" must have identical shapes");
85 void ValidateNumInputs(
const WorkloadInfo& workloadInfo, std::string
const& descName,
const unsigned int expectedSize)
90 ": Requires exactly " + to_string(expectedSize) +
"input(s). " +
96 void ValidateNumOutputs(
const WorkloadInfo& workloadInfo, std::string
const& descName,
const unsigned int expectedSize)
101 ": Requires exactly " + to_string(expectedSize) +
" output(s). " +
109 void ValidateTensorNumElements(
const TensorInfo& tensor,
110 std::string
const& descName,
111 unsigned int numElements,
112 std::string
const& tensorName)
118 tensorName +
" tensor.");
124 const std::string& descName, std::string
const& tensorName)
133 void ValidPerAxisQuantizedDataType(
const TensorInfo& tensor,
const std::string& descName,
const std::string& tensorName)
138 ": Expected data type which supports per-axis quantization scheme but got " +
144 void ValidateTensorQuantizationSpace(
const TensorInfo& first,
146 const std::string& descName,
147 std::string
const& firstName,
148 std::string
const& secondName)
160 if (firstDataType != secondDataType)
163 " must be of the same quantized type, " +
171 " must have the same quantization space, " +
180 void ValidateBiasTensorQuantization(
const TensorInfo& biasTensor,
182 const std::string& descName)
196 if (weightScales.size() != biasScales.size())
198 std::stringstream msg;
199 msg << descName <<
": Expected matching number of per-axis quantization scales for weights and bias, "
200 <<
"but got different values. This is currently unsupported: weights=" << weightScales.size()
201 <<
", biases=" << biasScales.size();
208 void ValidateTensors(
const std::vector<ITensorHandle*>& vec,
209 unsigned int numExpected,
210 const std::string& descName,
211 const std::string& varName)
213 if (vec.empty() && numExpected > 0)
218 for (
unsigned int i = 0; i < numExpected; ++i)
228 void ValidateBroadcastTensorShapesMatch(
const TensorInfo& first,
231 std::string
const& descName,
232 std::string
const& firstName,
233 std::string
const& secondName)
241 + firstName +
" & " + secondName
242 +
" must have the same number of dimensions in order to be broadcasted");
245 std::vector<uint32_t> outputDims(numDims, 0u);
246 for (uint32_t i = 0; i < numDims; i++)
249 const bool dimsNotOne = (first.
GetShape()[i] != 1) && (second.
GetShape()[i] != 1);
250 if (dimsNotEqual && dimsNotOne)
256 TensorShape broadcastShape =
TensorShape(armnn::numeric_cast<unsigned int>(outputDims.size()), outputDims.data());
257 if (broadcastShape != output.
GetShape())
260 + firstName +
" & " + secondName
261 +
" does not match the output shape");
266 void ValidateDataTypes(
const TensorInfo& info,
267 const std::vector<armnn::DataType>& supportedTypes,
268 std::string
const& descName)
270 auto iterator = std::find(supportedTypes.begin(), supportedTypes.end(),
info.GetDataType());
271 if (iterator == supportedTypes.end())
274 " is not supported.");
279 void ValidateTensorDataTypesMatch(
const TensorInfo& first,
281 std::string
const& descName,
282 std::string
const& firstName,
283 std::string
const& secondName)
288 " must have identical data types.");
293 void ValidateTensorNumElementsMatch(
const TensorInfo& first,
295 std::string
const& descName,
296 std::string
const& firstName,
297 std::string
const& secondName)
302 " must have the same number of elements.");
306 void ValidateWeightDataType(
const TensorInfo& inputInfo,
308 const std::string& descName)
313 const std::vector<DataType> validTypes =
320 ValidateDataTypes(weightInfo, validTypes, descName);
324 ValidateTensorDataTypesMatch(inputInfo, weightInfo, descName,
"input",
"weight");
328 void ValidatePerAxisQuantizationDimension(
const TensorInfo& tensorInfo,
329 const std::string& descName,
330 const std::string& tensorName)
336 "not set on tensor {1}.", descName, tensorName));
340 void ValidatePerAxisQuantizationOffset(
const TensorInfo& tensorInfo,
341 const std::string& descName,
342 const std::string& tensorName)
345 if (quantizationOffset != 0)
348 "{0}: Quantization offset for per-axis quantization expected to be 0 on tensor {1}, but got: {2}",
349 descName, tensorName, quantizationOffset));
353 void ValidatePerAxisQuantization(
const TensorInfo& inputInfo,
357 const std::string& descName)
364 const bool canHavePerAxisQuantization = (
IsQuantized8BitType(inputDataType)) && inputDataType == outputDataType;
366 if (!canHavePerAxisQuantization)
369 "{0}: Per-axis quantization parameters set on tensor {1}, but data type does not support "
370 "per-axis quantization.", descName,
"weight"));
374 ValidPerAxisQuantizedDataType(weightInfo, descName,
"weight");
375 ValidatePerAxisQuantizationDimension(weightInfo, descName,
"weight");
376 ValidatePerAxisQuantizationOffset(weightInfo, descName,
"weight");
384 "{}: Per-axis quantization parameters not set on bias tensor, "
385 "despite being set on weight tensor.", descName));
388 ValidateTensorDataType(biasInfo, DataType::Signed32, descName,
"bias");
389 ValidatePerAxisQuantizationDimension(biasInfo, descName,
"bias");
390 ValidatePerAxisQuantizationOffset(biasInfo, descName,
"bias");
399 std::string
const& descName,
400 unsigned int numDimensions,
401 std::string
const& tensorName)
const
408 unsigned int squeezedDims = 0;
417 if (tensor.
GetNumDimensions() < numDimensions || squeezedDims > numDimensions)
421 tensorName +
" tensor.");
430 tensorName +
" tensor.");
437 unsigned int numDimension,
438 unsigned int numElements,
439 std::string
const& tensorName)
const
441 const std::string functionName{
"ValidateTensorNumDimNumElem"};
443 ValidateTensorNumElements(tensorInfo, functionName, numElements, tensorName);
448 unsigned int numExpectedIn,
unsigned int numExpectedOut)
const
450 ValidateTensors(
m_Inputs, numExpectedIn, descName,
"input");
451 ValidateTensors(
m_Outputs, numExpectedOut, descName,
"output");
457 const std::string descriptorName{
"MapQueueDescriptor"};
459 ValidateNumInputs(workloadInfo, descriptorName, 1);
460 ValidateNumOutputs(workloadInfo, descriptorName, 0);
462 for (
unsigned int i = 0; i <
m_Inputs.size(); ++i)
467 fmt::format(
"{}: Invalid NULL input {}.", descriptorName,
static_cast<int>(i)));
475 const std::string descriptorName{
"UnmapQueueDescriptor"};
477 ValidateNumInputs(workloadInfo, descriptorName, 1);
478 ValidateNumOutputs(workloadInfo, descriptorName, 0);
480 for (
unsigned int i = 0; i <
m_Inputs.size(); ++i)
485 fmt::format(
"{}: Invalid NULL input {}.", descriptorName,
static_cast<int>(i)));
493 const std::string descriptorName{
"MemCopyQueueDescriptor"};
495 ValidateNumInputs(workloadInfo, descriptorName, 1);
496 ValidateNumOutputs(workloadInfo, descriptorName , 1);
501 ValidateTensorNumElementsMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
502 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
507 "{0}: Number of inputs ({1}) does not match the number of outputs ({2}).",
511 for (
unsigned int i = 0; i <
m_Inputs.size(); ++i)
516 "{0}: Invalid NULL input {1}.", descriptorName, i));
529 ValidateNumInputs(workloadInfo,
"MemImportQueueDescriptor", 1);
530 ValidateNumOutputs(workloadInfo,
"MemImportQueueDescriptor" , 1);
542 "Number of input infos ({0}) does not match the number of output infos ({1})",
552 "Number of elements for tensor input and output {} does not match", i ));
564 "Number of inputs ({0}) does not match the number of outputs ({1})",
568 for (
unsigned int i = 0; i <
m_Inputs.size(); ++i)
585 ValidateNumInputs(workloadInfo,
"MemSyncQueueDescriptor", 1);
606 const std::string descriptorName{
"ActivationQueueDescriptor"};
608 ValidateNumInputs(workloadInfo, descriptorName, 1);
609 ValidateNumOutputs(workloadInfo, descriptorName, 1);
614 std::vector<DataType> supportedTypes =
624 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
625 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
626 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
631 const std::string descriptorName{
"ArgMinMaxQueueDescriptor"};
633 ValidateNumInputs(workloadInfo, descriptorName, 1);
634 ValidateNumOutputs(workloadInfo, descriptorName, 1);
645 std::vector<DataType> supportedInputTypes =
657 ValidateDataTypes(inputTensorInfo, supportedInputTypes, descriptorName);
659 auto inputShape = inputTensorInfo.
GetShape();
660 auto outputShape = outputTensorInfo.
GetShape();
665 const std::string outputShapeError{
": Output tensor shape does not match shape inferred from input tensor."};
668 if (inputShape.GetNumDimensions() == 1)
670 if (outputShape.GetNumDimensions() != 1 && outputShape[0] != 1)
677 for (
unsigned int i = 0; i < unsignedAxis; ++i)
679 if (outputShape[i] != inputShape[i])
685 for (
auto i = unsignedAxis + 1; i < inputNumDimensions; ++i)
687 if (outputShape[i - 1] != inputShape[i])
697 const std::string descriptorName{
"CastQueueDescriptor"};
699 ValidateNumInputs(workloadInfo, descriptorName, 1);
700 ValidateNumOutputs(workloadInfo, descriptorName, 1);
705 std::vector<DataType> supportedTypes =
719 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
720 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
725 const std::string descriptorName{
"SoftmaxQueueDescriptor"};
727 ValidateNumInputs(workloadInfo, descriptorName, 1);
728 ValidateNumOutputs(workloadInfo, descriptorName, 1);
733 std::vector<DataType> supportedTypes =
743 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
744 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
745 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
750 const std::string descriptorName{
"SplitterQueueDescriptor"};
752 ValidateNumInputs(workloadInfo, descriptorName, 1);
755 std::vector<DataType> supportedTypes =
771 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
773 const std::string outputName =
"output_" + std::to_string(i);
774 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input", outputName);
785 descriptorName +
": Number of split windows "
786 "has to match number of workloadInfo.m_OutputTensorInfos. "
787 "Number of windows: " +
789 ". Number of workloadInfo.m_OutputTensorInfos: " + to_string(workloadInfo.
m_OutputTensorInfos.size()));
801 "have the same dimensionality as the input tensor. "
802 "Window origin (index: " +
803 to_string(w) +
") has " + to_string(e.
m_Origin.size()) +
804 " dimensions, the input "
806 to_string(inputDims) +
" dimensions.");
808 for (
unsigned int i = 0; i < e.
m_Origin.size(); ++i)
814 "be smaller or equal than the size of the input in that coord.");
822 const std::string descriptorName{
"ConcatQueueDescriptor"};
824 ValidateNumOutputs(workloadInfo, descriptorName, 1);
857 descriptorName +
": Number of split windows "
858 "has to match number of workloadInfo.m_InputTensorInfos. "
859 "Number of windows: " +
861 ". Number of workloadInfo.m_InputTensorInfos: " + to_string(workloadInfo.
m_InputTensorInfos.size()));
870 if (e.
m_Origin.size() != outputDims)
873 "have the same dimensionality as the output tensor. "
874 "Window origin (index: " +
875 to_string(w) +
") has " + to_string(e.
m_Origin.size()) +
876 " dimensions, the output "
878 to_string(outputDims) +
" dimensions.");
881 for (
unsigned int i = 0; i < e.
m_Origin.size(); ++i)
887 "be smaller or equal than the size of the output in that coord.");
893 std::vector<DataType> supportedTypes =
909 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
911 const std::string inputName =
"input_" + std::to_string(i);
912 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, inputName,
"output");
918 const std::string descriptorName{
"StackQueueDescriptor"};
920 ValidateNumOutputs(workloadInfo, descriptorName, 1);
947 "than the number of input dimensions.");
954 if (outputShape[i] != inputShape[i])
957 "match shape inferred from input tensor.");
964 "match shape inferred from input tensor.");
969 if (outputShape[i] != inputShape[i-1])
972 "match shape inferred from input tensor.");
982 std::vector<DataType> supportedTypes =
994 ValidateDataTypes(workloadInfo.
m_InputTensorInfos[0], supportedTypes, descriptorName);
1002 "input_" + std::to_string(i));
1014 const std::string descriptorName{
"FillQueueDescriptor"};
1016 ValidateNumInputs(workloadInfo, descriptorName, 1);
1017 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1024 std::vector<DataType> supportedTypes =
1032 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
1037 const std::string descriptorName{
"FullyConnectedQueueDescriptor"};
1039 uint32_t numInputs = 2;
1045 ValidateNumInputs(workloadInfo, descriptorName, numInputs);
1046 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1065 ValidateBiasTensorQuantization(biasTensorInfo, weightTensorInfo, descriptorName);
1071 std::vector<DataType> supportedTypes =
1082 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1090 "for BFloat16 input.");
1095 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1106 const std::string descriptorName{
"NormalizationQueueDescriptor"};
1108 ValidateNumInputs(workloadInfo, descriptorName, 1);
1109 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1115 std::vector<DataType> supportedTypes =
1125 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1127 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1129 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1134 const std::string descriptorName{
"AdditionQueueDescriptor"};
1136 ValidateNumInputs(workloadInfo, descriptorName, 2);
1137 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1143 std::vector<DataType> supportedTypes =
1154 ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName);
1155 ValidateDataTypes(inputTensorInfo1, supportedTypes, descriptorName);
1156 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
1158 ValidateTensorDataTypesMatch(inputTensorInfo0, inputTensorInfo1, descriptorName,
"input_0",
"input_1");
1159 ValidateTensorDataTypesMatch(inputTensorInfo1, outputTensorInfo, descriptorName,
"input_1",
"output");
1161 ValidateBroadcastTensorShapesMatch(inputTensorInfo0,
1171 const std::string descriptorName{
"MultiplicationQueueDescriptor"};
1173 ValidateNumInputs(workloadInfo, descriptorName, 2);
1174 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1180 std::vector<DataType> supportedTypes =
1191 ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName);
1192 ValidateDataTypes(inputTensorInfo1, supportedTypes, descriptorName);
1193 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
1195 ValidateTensorDataTypesMatch(inputTensorInfo0, inputTensorInfo1, descriptorName,
"input_0",
"input_1");
1196 ValidateTensorDataTypesMatch(inputTensorInfo1, outputTensorInfo, descriptorName,
"input_1",
"output");
1198 ValidateBroadcastTensorShapesMatch(inputTensorInfo0,
1208 const std::string descriptorName{
"BatchNormalizationQueueDescriptor"};
1210 ValidateNumInputs(workloadInfo, descriptorName, 1);
1211 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1216 std::vector<DataType> supportedTypes =
1226 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1227 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
1229 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1230 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1232 ValidatePointer(
m_Mean, descriptorName,
"mean");
1233 ValidatePointer(
m_Variance, descriptorName,
"variance");
1234 ValidatePointer(
m_Beta, descriptorName,
"beta");
1235 ValidatePointer(
m_Gamma, descriptorName,
"gamma");
1247 ValidateTensorShapesMatch(mean, variance, descriptorName,
"mean",
"variance");
1248 ValidateTensorShapesMatch(mean, beta, descriptorName,
"mean",
"beta");
1249 ValidateTensorShapesMatch(mean, gamma, descriptorName,
"mean",
"gamma");
1254 const std::string descriptorName{
"Convolution2dQueueDescriptor"};
1256 uint32_t numInputs = 2;
1262 ValidateNumInputs(workloadInfo, descriptorName, numInputs);
1263 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1275 ValidateWeightDataType(inputTensorInfo, weightTensorInfo, descriptorName);
1280 optionalBiasTensorInfo = MakeOptional<TensorInfo>(workloadInfo.
m_InputTensorInfos[2]);
1284 ValidateBiasTensorQuantization(biasTensorInfo, weightTensorInfo, descriptorName);
1290 fmt::format(
"{}: strideX (provided {}) and strideY (provided {}) "
1291 "cannot be either negative or 0.",
1295 ValidatePerAxisQuantization(inputTensorInfo,
1298 optionalBiasTensorInfo,
1301 std::vector<DataType> supportedTypes =
1312 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1320 "for BFloat16 input.");
1325 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1331 const std::string descriptorName{
"Convolution3dQueueDescriptor"};
1333 uint32_t numInputs = 2;
1338 ValidateNumInputs(workloadInfo, descriptorName, numInputs);
1339 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1350 ValidateWeightDataType(inputTensorInfo, weightTensorInfo, descriptorName);
1355 optionalBiasTensorInfo = MakeOptional<TensorInfo>(workloadInfo.
m_InputTensorInfos[2]);
1359 ValidateBiasTensorQuantization(biasTensorInfo, weightTensorInfo, descriptorName);
1365 fmt::format(
"{}: strideX (provided {}), strideY (provided {}) or strideZ (provided {})"
1366 "cannot be either negative or 0.",
1370 ValidatePerAxisQuantization(inputTensorInfo,
1373 optionalBiasTensorInfo,
1376 std::vector<DataType> supportedTypes =
1387 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1388 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1393 const std::string descriptorName{
"DepthwiseConvolution2dQueueDescriptor"};
1395 uint32_t numInputs = 2;
1401 ValidateNumInputs(workloadInfo, descriptorName, numInputs);
1402 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1416 fmt::format(
"{}: dilationX (provided {}) and dilationY (provided {}) "
1417 "cannot be smaller than 1.",
1424 fmt::format(
"{}: strideX (provided {}) and strideY (provided {}) "
1425 "cannot be either negative or 0.",
1429 if (weightTensorInfo.
GetShape()[0] != 1)
1432 "{0}: The weight format in armnn is expected to be [1, H, W, Cout]."
1433 "But first dimension is not equal to 1. Provided weight shape: [{1}, {2}, {3}, {4}]",
1442 const unsigned int numWeightOutputChannelsRefFormat = weightTensorInfo.
GetShape()[3];
1443 const unsigned int numWeightOutputChannelsAclFormat = weightTensorInfo.
GetShape()[1];
1444 const unsigned int numOutputChannels = outputTensorInfo.
GetShape()[channelIndex];
1447 bool validRefFormat = (numWeightOutputChannelsRefFormat == numOutputChannels);
1448 bool validAclFormat = (numWeightOutputChannelsAclFormat == numOutputChannels);
1450 if (!(validRefFormat || validAclFormat))
1453 "{0}: The weight format in armnn is expected to be [1, H, W, Cout] (CpuRef) or [1, Cout, H, W] "
1454 "(CpuAcc/GpuAcc). But neither the 4th (CpuRef) or 2nd (CpuAcc/GpuAcc) dimension is equal to Cout."
1455 "Cout = {1} Provided weight shape: [{2}, {3}, {4}, {5}]",
1464 ValidateWeightDataType(inputTensorInfo, weightTensorInfo, descriptorName);
1469 optionalBiasTensorInfo = MakeOptional<TensorInfo>(workloadInfo.
m_InputTensorInfos[2]);
1472 ValidateBiasTensorQuantization(biasTensorInfo, weightTensorInfo, descriptorName);
1475 ValidatePerAxisQuantization(inputTensorInfo,
1478 optionalBiasTensorInfo,
1481 std::vector<DataType> supportedTypes =
1491 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1492 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1497 const std::string descriptorName{
"PermuteQueueDescriptor"};
1499 ValidateNumInputs(workloadInfo, descriptorName, 1);
1500 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1510 for (
unsigned int i = 0u; i < mapping.
GetSize(); ++i)
1512 if (inputTensorInfo.
GetShape()[i] != outputTensorInfo.
GetShape()[mapping[i]])
1515 " (=" + to_string(inputTensorInfo.
GetShape()[i]) +
") " +
1516 "must match dst dimension " + to_string(mapping[i]) +
1517 " (=" + to_string(outputTensorInfo.
GetShape()[mapping[i]]) +
")");
1521 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1526 const std::string descriptorName{
"Pooling2dQueueDescriptor"};
1528 ValidateNumInputs(workloadInfo, descriptorName, 1);
1529 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1537 std::vector<DataType> supportedTypes =
1547 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1548 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1553 const std::string descriptorName{
"Pooling3dQueueDescriptor"};
1555 ValidateNumInputs(workloadInfo, descriptorName, 1);
1556 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1564 std::vector<DataType> supportedTypes =
1574 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1575 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1580 const std::string descriptorName{
"ResizeQueueDescriptor"};
1582 ValidateNumInputs(workloadInfo, descriptorName, 1);
1583 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1591 std::vector<DataType> supportedTypes =
1602 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1603 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1606 const unsigned int inputBatchSize = inputTensorInfo.
GetShape()[0];
1607 const unsigned int outputBatchSize = outputTensorInfo.
GetShape()[0];
1608 if (inputBatchSize != outputBatchSize)
1611 fmt::format(
"{}: Input batch size ({}) does not match output batch size ({})",
1612 descriptorName, inputBatchSize, outputBatchSize));
1618 if (inputChannelCount != outputChannelCount)
1621 fmt::format(
"{}: Input channel count ({}) does not match output channel count ({})",
1622 descriptorName, inputChannelCount, outputChannelCount));
1628 const std::string descriptorName{
"ReverseV2QueueDescriptor"};
1631 const unsigned int maxDimensions = 4;
1633 ValidateNumInputs(workloadInfo, descriptorName, 2);
1634 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1641 if (inputTensorNumDimensions > maxDimensions)
1644 ": Input tensors with rank greater than " +
1645 std::to_string(maxDimensions) +
" are not supported.");
1649 if (axisTensorNumDimensions > maxDimensions)
1652 ": More than " + std::to_string(maxDimensions) +
" axes cannot be specified.");
1655 if (axisTensorNumDimensions > inputTensorNumDimensions)
1658 ": More axes specified than the number of axes on the input tensor.");
1661 std::vector<DataType> supportedTypes =
1673 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1675 std::vector<DataType> axisSupportedTypes =
1680 ValidateDataTypes(axisTensorInfo, axisSupportedTypes, descriptorName);
1682 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1683 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1688 const std::string descriptorName{
"FakeQuantizationQueueDescriptor"};
1690 ValidateNumInputs(workloadInfo, descriptorName, 1);
1691 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1699 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1709 const std::string descriptorName{
"InstanceNormalizationQueueDescriptor"};
1711 ValidateNumInputs(workloadInfo, descriptorName, 1);
1712 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1722 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1725 std::vector<DataType> supportedTypes =
1732 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1733 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1738 const std::string descriptorName{
"L2NormalizationQueueDescriptor"};
1740 ValidateNumInputs(workloadInfo, descriptorName, 1);
1741 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1751 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1754 std::vector<DataType> supportedTypes =
1764 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1765 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1770 const std::string descriptorName{
"LogSoftmaxQueueDescriptor"};
1772 ValidateNumInputs(workloadInfo, descriptorName, 1);
1773 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1778 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1780 std::vector<DataType> supportedTypes =
1787 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1788 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1793 const std::string descriptorName{
"ConstantQueueDescriptor"};
1795 ValidateNumInputs(workloadInfo, descriptorName, 0);
1796 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1807 std::vector<DataType> supportedTypes =
1819 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
1824 const std::string descriptorName{
"ReshapeQueueDescriptor"};
1826 ValidateNumInputs(workloadInfo, descriptorName, 1);
1827 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1832 ValidateTensorNumElementsMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1835 std::vector<DataType> supportedTypes =
1847 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1848 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1853 const std::string descriptorName{
"SpaceToBatchNdQueueDescriptor"};
1855 ValidateNumInputs(workloadInfo, descriptorName, 1);
1856 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1864 "dimensions as Block Shape.");
1886 const unsigned int inputWidth = (inputTensorInfo.
GetNumDimensions() == 3) ? 1 :
1891 const unsigned int channelsIndex = channelsIndex_int < 0 ?
1892 static_cast<unsigned int>(channelsIndex_int) + inputTensorInfo.
GetNumDimensions()
1893 :
static_cast<unsigned int>(channelsIndex_int);
1895 const unsigned int numInputElements = inputTensorInfo.
GetShape()[0] *
1898 inputTensorInfo.
GetShape()[channelsIndex];
1903 to_string(numInputElements) +
" after padding but output tensor has " +
1912 unsigned int spatialDimension = firstSpatialDimension + i;
1913 auto inputSize = inputTensorInfo.
GetShape()[spatialDimension] +
1919 "divisible by Block Shape in dimension: " + to_string(spatialDimension) +
".");
1923 std::vector<DataType> supportedTypes =
1933 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1934 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1939 const std::string descriptorName{
"SpaceToDepthQueueDescriptor"};
1941 ValidateNumInputs(workloadInfo, descriptorName, 1);
1942 ValidateNumOutputs(workloadInfo, descriptorName, 1);
1950 std::vector<DataType> supportedTypes =
1960 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1961 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
1963 ValidateTensorNumElementsMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
1971 const unsigned int wIndex = dimensionIndices.
GetWidthIndex();
1979 "by block size in all spatial dimensions");
1986 "must be divisible by the square of block size." );
1992 const std::string descriptorName{
"FloorQueueDescriptor"};
1994 ValidateNumInputs(workloadInfo, descriptorName, 1);
1995 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2000 std::vector<DataType> supportedTypes =
2008 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
2009 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2010 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2011 ValidateTensorQuantizationSpace(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2018 const std::string descriptorName{
"LstmQueueDescriptor"};
2030 std::vector<DataType> supportedTypes =
2039 ValidateDataTypes(workloadInfo.
m_InputTensorInfos[0], supportedTypes, descriptorName);
2048 "input_" + std::to_string(i));
2055 "LstmQueueDescriptor",
2057 "output_" + std::to_string(i));
2082 descriptorName +
" input_0");
2085 descriptorName +
" input_1");
2088 descriptorName +
" input_2");
2092 descriptorName +
" output_0");
2095 descriptorName +
" output_1");
2098 descriptorName +
" output_2");
2101 descriptorName +
" output_3");
2107 (n_cell * n_input),
"InputLayerNormWeights");
2112 (n_cell * n_input),
"InputToForgetWeights");
2116 (n_cell * n_input),
"InputToCellWeights");
2121 (n_cell * n_output),
"RecurrentToInputWeights");
2126 (n_cell * n_output),
"RecurrentToForgetWeights");
2130 (n_cell * n_output),
"RecurrentToCellWeights");
2138 if (!cifg_weights_all_or_none)
2141 "RecurrentToInputWeights must either both be present (regular LSTM) "
2142 "or both not present (CIFG-LSTM). In addition CifgEnable must be set "
2149 n_cell,
"CellToInputWeights");
2154 n_cell,
"CellToForgetWeights");
2159 n_cell,
"CellToOutputWeights");
2163 bool peephole_weights_all_or_none =
2168 if (!peephole_weights_all_or_none)
2186 "must be present.");
2189 n_cell,
"InputGateBias");
2195 ValidatePointer(
m_CellBias,
"Null pointer check",
"CellBias");
2204 (n_cell * n_output),
"ProjectionWeights");
2221 if (!projecton_tensors_consistent)
2254 "disabled but InputLayerNormWeights are not present");
2257 1, n_cell,
"InputLayerNormWeights");
2266 "ForgetLayerNormWeights");
2270 "OutputLayerNormWeights");
2274 "CellLayerNormWeights");
2280 "normalisation weights are present.");
2286 const std::string descriptorName{
"ConvertFp32ToFp16QueueDescriptor"};
2288 ValidateNumInputs(workloadInfo, descriptorName, 1);
2289 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2304 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2309 const std::string descriptorName{
"ConvertFp16ToFp32QueueDescriptor"};
2311 ValidateNumInputs(workloadInfo, descriptorName, 1);
2312 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2327 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2332 const std::string descriptorName{
"DivisionQueueDescriptor"};
2334 ValidateNumInputs(workloadInfo, descriptorName, 2);
2335 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2341 std::vector<DataType> supportedTypes =
2352 ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName);
2353 ValidateDataTypes(inputTensorInfo1, supportedTypes, descriptorName);
2354 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
2356 ValidateBroadcastTensorShapesMatch(inputTensorInfo0,
2366 const std::string descriptorName{
"SubtractionQueueDescriptor"};
2368 ValidateNumInputs(workloadInfo, descriptorName, 2);
2369 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2375 std::vector<DataType> supportedTypes =
2386 ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName);
2387 ValidateDataTypes(inputTensorInfo1, supportedTypes, descriptorName);
2388 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
2390 ValidateBroadcastTensorShapesMatch(inputTensorInfo0,
2400 const std::string descriptorName{
"MaximumQueueDescriptor"};
2402 ValidateNumInputs(workloadInfo, descriptorName, 2);
2403 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2409 std::vector<DataType> supportedTypes =
2420 ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName);
2421 ValidateDataTypes(inputTensorInfo1, supportedTypes, descriptorName);
2422 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
2424 ValidateBroadcastTensorShapesMatch(inputTensorInfo0,
2434 const std::string descriptorName{
"MeanQueueDescriptor"};
2436 ValidateNumInputs(workloadInfo, descriptorName, 1);
2437 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2442 std::vector<DataType> supportedTypes =
2455 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
2456 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2468 unsigned int outputDim =
2472 outputDim > 0 ? outputDim : 1,
2479 const std::string descriptorName{
"PadQueueDescriptor"};
2481 ValidateNumInputs(workloadInfo, descriptorName, 1);
2482 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2493 "as there are dimensions in the input tensor that is " +
2501 const std::string descriptorName{
"QuantizeQueueDescriptor"};
2503 ValidateNumInputs(workloadInfo, descriptorName, 1);
2504 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2509 std::vector<DataType> supportedTypes =
2520 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
2530 const std::string descriptorName{
"BatchToSpaceNdQueueDescriptor"};
2532 ValidateNumInputs(workloadInfo, descriptorName, 1);
2533 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2541 "dimensions as Block Shape.");
2564 unsigned int spatialDimension = firstSpatialDimension + i;
2567 if (cropSize > outputSize)
2570 "outputSize in dimension: " + to_string(spatialDimension) +
".");
2574 std::vector<DataType> supportedTypes =
2584 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
2585 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2590 const std::string descriptorName{
"StridedSliceQueueDescriptor"};
2592 ValidateNumInputs(workloadInfo, descriptorName, 1);
2593 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2598 std::vector<DataType> supportedTypes =
2608 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
2609 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2611 ValidateTensorQuantizationSpace(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2647 const std::string descriptorName{
"MinimumQueueDescriptor"};
2649 ValidateNumInputs(workloadInfo, descriptorName, 2);
2650 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2656 std::vector<DataType> supportedTypes =
2667 ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName);
2668 ValidateDataTypes(inputTensorInfo1, supportedTypes, descriptorName);
2669 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
2671 ValidateBroadcastTensorShapesMatch(inputTensorInfo0,
2681 const std::string descriptorName{
"DebugQueueDescriptor"};
2683 ValidateNumInputs(workloadInfo, descriptorName, 1);
2684 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2689 const std::string descriptorName{
"EqualQueueDescriptor"};
2691 ValidateNumInputs(workloadInfo, descriptorName, 2);
2692 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2698 ValidateBroadcastTensorShapesMatch(inputTensorInfo0,
2713 const std::string descriptorName{
"GreaterQueueDescriptor"};
2715 ValidateNumInputs(workloadInfo, descriptorName, 2);
2716 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2722 ValidateBroadcastTensorShapesMatch(inputTensorInfo0,
2737 const std::string descriptorName{
"RsqrtQueueDescriptor"};
2739 ValidateNumInputs(workloadInfo, descriptorName, 1);
2740 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2745 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2747 std::vector<DataType> supportedTypes =
2757 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
2758 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2763 const std::string descriptorName{
"GatherNdQueueDescriptor"};
2765 ValidateNumInputs(workloadInfo, descriptorName, 2);
2766 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2777 std::vector<DataType> supportedTypes =
2788 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
2790 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2798 const std::string descriptorName{
"GatherQueueDescriptor"};
2800 ValidateNumInputs(workloadInfo, descriptorName, 2);
2801 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2812 std::vector<DataType> supportedTypes =
2823 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
2825 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
2833 const std::string& descriptorName{
"DetectionPostProcessQueueDescriptor"};
2835 ValidateNumInputs(workloadInfo, descriptorName, 2);
2861 const std::vector<DataType> supportedInputTypes =
2871 ValidateDataTypes(boxEncodingsInfo, supportedInputTypes, descriptorName);
2872 ValidateDataTypes(scoresInfo, supportedInputTypes, descriptorName);
2873 ValidateDataTypes(anchorsInfo, supportedInputTypes, descriptorName);
2881 ValidateTensorDataType(detectionBoxesInfo,
DataType::Float32, descriptorName,
"detection boxes");
2882 ValidateTensorDataType(detectionScoresInfo,
DataType::Float32, descriptorName,
"detection scores");
2883 ValidateTensorDataType(detectionClassesInfo,
DataType::Float32, descriptorName,
"detection classes");
2884 ValidateTensorDataType(numDetectionsInfo,
DataType::Float32, descriptorName,
"num detections");
2889 "must be positive and less than or equal to 1.");
2895 "should be equal to number of classes + 1.");
2901 const std::string& descriptorName{
"DequantizeQueueDescriptor"};
2903 ValidateNumInputs(workloadInfo, descriptorName, 1);
2904 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2909 std::vector<DataType> inputSupportedTypes =
2917 ValidateDataTypes(inputTensorInfo, inputSupportedTypes, descriptorName);
2919 std::vector<DataType> outputSupportedTypes =
2926 ValidateDataTypes(outputTensorInfo, outputSupportedTypes, descriptorName);
2931 const std::string& descriptorName{
"MergeQueueDescriptor"};
2933 ValidateNumInputs(workloadInfo, descriptorName, 2);
2934 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2940 ValidateTensorShapesMatch(inputTensorInfo0, inputTensorInfo1, descriptorName,
"input_0",
"input_1");
2941 ValidateTensorShapesMatch(inputTensorInfo0, outputTensorInfo, descriptorName,
"input_0",
"output");
2943 ValidateTensorDataTypesMatch(inputTensorInfo0, inputTensorInfo1, descriptorName,
"input_0",
"input_1");
2944 ValidateTensorDataTypesMatch(inputTensorInfo0, outputTensorInfo, descriptorName,
"input_0",
"output");
2949 const std::string& descriptorName{
"ShapeQueueDescriptor"};
2951 ValidateNumInputs(workloadInfo, descriptorName, 1);
2952 ValidateNumOutputs(workloadInfo, descriptorName, 1);
2957 std::vector<DataType> supportedTypes =
2969 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
2975 const std::string& descriptorName{
"SwitchQueueDescriptor"};
2977 ValidateNumInputs(workloadInfo, descriptorName, 2);
2978 ValidateNumOutputs(workloadInfo, descriptorName, 2);
2986 std::vector<DataType> supportedTypes =
2995 ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName);
2996 ValidateDataTypes(inputTensorInfo1, supportedTypes, descriptorName);
2998 ValidateDataTypes(outputTensorInfo0, supportedTypes, descriptorName);
2999 ValidateDataTypes(outputTensorInfo1, supportedTypes, descriptorName);
3001 ValidateTensorShapesMatch(inputTensorInfo0,
3007 ValidateTensorShapesMatch(inputTensorInfo0,
3021 const std::string& descriptorName{
"PreluQueueDescriptor"};
3023 ValidateNumInputs(workloadInfo, descriptorName, 2);
3024 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3030 std::vector<DataType> supportedTypes
3040 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
3041 ValidateDataTypes(alphaTensorInfo, supportedTypes, descriptorName);
3043 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
3045 ValidateTensorDataTypesMatch(inputTensorInfo, alphaTensorInfo, descriptorName,
"input",
"alpha");
3046 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"ouptut");
3048 ValidateBroadcastTensorShapesMatch(inputTensorInfo,
3058 const std::string descriptorName{
"TransposeConvolution2dQueueDescriptor"};
3060 ValidateNumInputs(workloadInfo, descriptorName, 1);
3061 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3069 ValidatePointer(
m_Weight, descriptorName,
"weight");
3074 ValidateWeightDataType(inputTensorInfo, weightTensorInfo, descriptorName);
3079 ValidatePointer(
m_Bias, descriptorName,
"bias");
3085 ValidateBiasTensorQuantization(biasTensorInfo, weightTensorInfo, descriptorName);
3088 ValidatePerAxisQuantization(inputTensorInfo,
3091 optionalBiasTensorInfo,
3094 std::vector<DataType> supportedTypes =
3104 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
3105 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
3110 const std::string descriptorName{
"TransposeQueueDescriptor"};
3112 ValidateNumInputs(workloadInfo, descriptorName, 1);
3113 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3123 for (
unsigned int i = 0u; i < mapping.
GetSize(); ++i)
3125 if (inputTensorInfo.
GetShape()[mapping[i]] != outputTensorInfo.
GetShape()[i])
3128 " (=" + to_string(inputTensorInfo.
GetShape()[mapping[i]]) +
") " +
3129 "must match dst dimension " + to_string(i) +
3130 " (=" + to_string(outputTensorInfo.
GetShape()[i]) +
")");
3134 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
3139 const std::string descriptorName{
"TransposeQueueDescriptor"};
3141 ValidateNumInputs(workloadInfo, descriptorName, 1);
3142 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3147 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
3152 const std::string descriptorName{
"QLstmQueueDescriptor"};
3155 ValidateNumInputs(workloadInfo, descriptorName, 3);
3156 ValidateNumOutputs(workloadInfo, descriptorName, 3);
3168 std::vector<DataType> inputOutputSupportedTypes =
3173 std::vector<DataType> cellStateSupportedTypes =
3178 std::vector<DataType> weightsSupportedTypes =
3183 std::vector<DataType> layerNormPeepholeWeightsSupportedTypes =
3188 std::vector<DataType> biasSupportedTypes =
3194 ValidateDataTypes(inputInfo, inputOutputSupportedTypes, descriptorName);
3195 ValidateDataTypes(outputStateInInfo, inputOutputSupportedTypes, descriptorName);
3196 ValidateDataTypes(cellStateInInfo, cellStateSupportedTypes, descriptorName);
3198 ValidateDataTypes(outputStateOutInfo, inputOutputSupportedTypes, descriptorName);
3199 ValidateDataTypes(cellStateOutInfo, cellStateSupportedTypes, descriptorName);
3200 ValidateDataTypes(outputInfo, inputOutputSupportedTypes, descriptorName);
3203 ValidateTensorDataTypesMatch(inputInfo, outputStateInInfo, descriptorName,
"input",
"outputStateIn");
3204 ValidateTensorDataTypesMatch(outputStateInInfo, outputStateOutInfo, descriptorName,
3205 "outputStateIn",
"outputStateOut");
3206 ValidateTensorDataTypesMatch(cellStateInInfo, cellStateOutInfo, descriptorName,
"cellStateIn",
"cellStateOut");
3209 const uint32_t numBatches = inputInfo.
GetShape()[0];
3210 const uint32_t inputSize = inputInfo.
GetShape()[1];
3211 const uint32_t outputSize = outputStateInInfo.GetShape()[1];
3212 const uint32_t numUnits = cellStateInInfo.GetShape()[1];
3239 " RecurrentToForgetWeights");
3250 ValidateDataTypes(inputToForgetWeightsInfo, weightsSupportedTypes, descriptorName);
3252 ValidateTensorDataTypesMatch(inputToForgetWeightsInfo, inputToCellWeightsInfo, descriptorName,
3253 "inputToForgetWeights",
"inputToCellWeights");
3254 ValidateTensorDataTypesMatch(inputToForgetWeightsInfo, inputToOutputWeightsInfo, descriptorName,
3255 "inputToForgetWeights",
"inputToOutputWeights");
3257 ValidateTensorDataTypesMatch(inputToForgetWeightsInfo, recurrentToForgetWeightsInfo, descriptorName,
3258 "inputToForgetWeights",
"recurrentToForgeteights");
3259 ValidateTensorDataTypesMatch(inputToForgetWeightsInfo, recurrentToCellWeightsInfo, descriptorName,
3260 "inputToForgetWeights",
"recurrentToCellWeights");
3261 ValidateTensorDataTypesMatch(inputToForgetWeightsInfo, recurrentToOutputWeightsInfo, descriptorName,
3262 "inputToForgetWeights",
"recurrentToOutputWeights");
3269 ValidatePointer(
m_CellBias, descriptorName,
"CellBias");
3278 ValidateDataTypes(forgetGateBiasInfo, biasSupportedTypes, descriptorName);
3280 ValidateTensorDataTypesMatch(forgetGateBiasInfo, cellBiasInfo, descriptorName,
3281 "forgetGateBias",
"cellBias");
3282 ValidateTensorDataTypesMatch(forgetGateBiasInfo, outputGateBiasInfo, descriptorName,
3283 "forgetGateBias",
"outputGateBias");
3291 if (!allCifgParamsPresentOrNot)
3294 ": InputToInputWeights, RecurrentToInputWeights and InputGateBias must either all be present "
3295 "(CIFG disabled) or not be present at all (CIFG enabled). m_Parameters.m_CifgEnabled should be "
3296 "set appropriately.");
3307 " RecurrentToInputWeights");
3313 ValidateTensorDataTypesMatch(inputToForgetWeightsInfo, inputToInputWeightsInfo, descriptorName,
3314 "inputToForgetWeights",
"inputToInputWeights");
3315 ValidateTensorDataTypesMatch(inputToForgetWeightsInfo, recurrentToInputWeightsInfo, descriptorName,
3316 "inputToForgetWeights",
"recurrentToInputWeights");
3317 ValidateTensorDataTypesMatch(forgetGateBiasInfo, inputGateBiasInfo, descriptorName,
3318 "forgetGateBias",
"inputGateBias");
3322 bool allPeepholeWeightsPresentOrNot =
3328 if (!allPeepholeWeightsPresentOrNot)
3331 ": CellToInputWeights, CellToForgetWeights and CellToOutputWeights should all be present (Peephole "
3332 "enabled) or not be present at all (Peephole disabled). CellToInputWeights should only be present "
3333 "when Peephole is enabled and CIFG is disabled. m_Parameters.m_PeepholeEnabled should be set "
3341 ValidateDataTypes(cellToForgetWeightsInfo, layerNormPeepholeWeightsSupportedTypes, descriptorName);
3345 ValidateTensorDataTypesMatch(cellToForgetWeightsInfo, cellToOutputWeightsInfo, descriptorName,
3346 "cellToForgetWeight",
"cellToOutputWeights");
3352 ValidateTensorDataTypesMatch(cellToForgetWeightsInfo, cellToInputWeightsInfo, descriptorName,
3353 "cellToForgetWeights",
"cellToInputWeights");
3358 bool allLayerNormWeightsPresentOrNot =
3364 if (!allLayerNormWeightsPresentOrNot)
3367 ": InputLayerNormWeights, ForgetLayerNormWeights, m_OutputLayerNormWeights "
3368 "and CellLayerNormWeights should all be present (Layer Norm enabled) or not "
3369 "be present at all (Layer Norm disabled). InputLayerNormWeights should "
3370 "only be present when Layer Norm is enabled and CIFG is disabled. "
3371 "m_Parameters.m_LayerNormEnabled should be set appropriately.");
3378 ValidateDataTypes(forgetLayerNormWeightsInfo, layerNormPeepholeWeightsSupportedTypes, descriptorName);
3382 ValidateTensorDataTypesMatch(forgetLayerNormWeightsInfo, cellLayerNormWeightsInfo, descriptorName,
3383 "forgetLayerNormWeights",
"cellLayerNormWeights");
3387 ValidateTensorDataTypesMatch(forgetLayerNormWeightsInfo, outputLayerNormWeightsInfo, descriptorName,
3388 "forgetLayerNormWeights",
"outputLayerNormWeights");
3394 ValidateTensorDataTypesMatch(forgetLayerNormWeightsInfo, inputLayerNormWeightsInfo, descriptorName,
3395 "forgetLayerNormWeights",
"inputLayerNormWeights");
3400 bool correctProjectionTensorsPresent =
3405 if (!correctProjectionTensorsPresent)
3408 ": If projection is enabled, ProjectionWeights should be present and "
3409 "ProjectionBias is optional. If projection is disabled, neither "
3410 "ProjectionWeights nor ProjectionBias should be present.");
3417 ValidateDataTypes(projectionWeightsInfo, weightsSupportedTypes, descriptorName);
3423 ValidateDataTypes(projectionBiasInfo, biasSupportedTypes, descriptorName);
3430 ": If projection is disabled, output quantization info (scale, offset) "
3431 "should match HiddenStateScale and HiddenStateZeroPoint.");
3438 const std::string descriptorName{
"QuantizedLstmQueueDescriptor"};
3441 ValidateNumInputs(workloadInfo, descriptorName, 3);
3442 ValidateNumOutputs(workloadInfo, descriptorName, 2);
3452 std::vector<DataType> inputOutputSupportedTypes =
3457 std::vector<DataType> cellStateSupportedTypes =
3462 std::vector<DataType> weightsSupportedTypes =
3467 std::vector<DataType> biasSupportedTypes =
3473 ValidateDataTypes(inputInfo, inputOutputSupportedTypes, descriptorName);
3474 ValidateDataTypes(cellStateInInfo, cellStateSupportedTypes, descriptorName);
3475 ValidateDataTypes(outputStateInInfo, inputOutputSupportedTypes, descriptorName);
3477 ValidateDataTypes(cellStateOutInfo, cellStateSupportedTypes, descriptorName);
3478 ValidateDataTypes(outputStateOutInfo, inputOutputSupportedTypes, descriptorName);
3481 ValidateTensorDataTypesMatch(inputInfo, outputStateInInfo, descriptorName,
"input",
"outputStateIn");
3482 ValidateTensorDataTypesMatch(outputStateInInfo, outputStateOutInfo, descriptorName,
3483 "outputStateIn",
"outputStateOut");
3484 ValidateTensorDataTypesMatch(cellStateInInfo, cellStateOutInfo, descriptorName,
"cellStateIn",
"cellStateOut");
3487 ValidateTensorQuantizationSpace(inputInfo, outputStateInInfo, descriptorName,
"input",
"outputStateIn");
3488 ValidateTensorQuantizationSpace(inputInfo, outputStateOutInfo, descriptorName,
"input",
"outputStateOut");
3489 ValidateTensorQuantizationSpace(cellStateInInfo, cellStateOutInfo, descriptorName,
"cellStateIn",
"cellStateOut");
3492 const uint32_t numBatches = inputInfo.
GetShape()[0];
3493 const uint32_t inputSize = inputInfo.
GetShape()[1];
3494 const uint32_t outputSize = cellStateInInfo.GetShape()[1];
3527 " RecurrentToForgetWeights");
3538 ValidateDataTypes(inputToInputWeightsInfo, weightsSupportedTypes, descriptorName);
3540 ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToForgetWeightsInfo, descriptorName,
3541 "inputToInputWeights",
"inputToForgetWeights");
3542 ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToCellWeightsInfo, descriptorName,
3543 "inputToInputWeights",
"inputToCellWeights");
3544 ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToOutputWeightsInfo, descriptorName,
3545 "inputToInputWeights",
"inputToOutputWeights");
3547 ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToInputWeightsInfo, descriptorName,
3548 "inputToInputWeights",
"recurrentToInputWeights");
3549 ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToForgetWeightsInfo, descriptorName,
3550 "inputToInputWeights",
"recurrentToForgeteights");
3551 ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToCellWeightsInfo, descriptorName,
3552 "inputToInputWeights",
"recurrentToCellWeights");
3553 ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToOutputWeightsInfo, descriptorName,
3554 "inputToInputWeights",
"recurrentToOutputWeights");
3557 ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToForgetWeightsInfo,
3558 descriptorName,
"inputToInputWeights",
"inputToForgetWeights");
3559 ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToCellWeightsInfo,
3560 descriptorName,
"inputToInputWeights",
"inputToCellWeights");
3561 ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToOutputWeightsInfo,
3562 descriptorName,
"inputToInputWeights",
"inputToOutputWeights");
3564 ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToInputWeightsInfo,
3565 descriptorName,
"inputToInputWeights",
"recurrentToInputWeights");
3566 ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToForgetWeightsInfo,
3567 descriptorName,
"inputToInputWeights",
"recurrentToForgetWeights");
3568 ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToCellWeightsInfo,
3569 descriptorName,
"inputToInputWeights",
"recurrentToCellWeights");
3570 ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToOutputWeightsInfo,
3571 descriptorName,
"inputToInputWeights",
"recurrentToOutputWeights");
3582 ValidatePointer(
m_CellBias, descriptorName,
"CellBias");
3591 ValidateDataTypes(inputGateBiasInfo, biasSupportedTypes, descriptorName);
3593 ValidateTensorDataTypesMatch(inputGateBiasInfo, forgetGateBiasInfo, descriptorName,
3594 "inputGateBias",
"forgetGateBias");
3595 ValidateTensorDataTypesMatch(inputGateBiasInfo, cellBiasInfo, descriptorName,
3596 "inputGateBias",
"cellBias");
3597 ValidateTensorDataTypesMatch(inputGateBiasInfo, outputGateBiasInfo, descriptorName,
3598 "inputGateBias",
"outputGateBias");
3601 ValidateBiasTensorQuantization(inputGateBiasInfo, inputToInputWeightsInfo, descriptorName);
3602 ValidateBiasTensorQuantization(forgetGateBiasInfo, inputToInputWeightsInfo, descriptorName);
3603 ValidateBiasTensorQuantization(cellBiasInfo, inputToInputWeightsInfo, descriptorName);
3604 ValidateBiasTensorQuantization(outputGateBiasInfo, inputToInputWeightsInfo, descriptorName);
3609 const std::string descriptorName{
"AbsQueueDescriptor"};
3611 ValidateNumInputs(workloadInfo, descriptorName, 1);
3612 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3617 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
3619 std::vector<DataType> supportedTypes =
3630 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
3631 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
3636 const std::string descriptorName{
"SliceQueueDescriptor"};
3638 ValidateNumInputs(workloadInfo, descriptorName, 1);
3639 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3644 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
3658 ": Length of begin offset descriptor must equal rank " + std::to_string(rank));
3663 ": Length of size descriptor must equal rank " + std::to_string(rank));
3668 for (
unsigned int i = 0u; i < rank; ++i)
3679 for(
unsigned int i = 0u; i < rank; ++i)
3684 std::to_string(i) +
" exceeds input size.");
3691 const std::string descriptorName{
"DepthToSpaceQueueDescriptor"};
3693 ValidateNumInputs(workloadInfo, descriptorName, 1);
3694 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3702 std::vector<DataType> supportedTypes =
3712 ValidateDataTypes(inputInfo, supportedTypes, descriptorName);
3713 ValidateDataTypes(outputInfo, supportedTypes, descriptorName);
3715 ValidateTensorNumElementsMatch(inputInfo, outputInfo, descriptorName,
"input",
"output");
3723 const unsigned int wIndex = dimensionIndices.
GetWidthIndex();
3731 "must be divisible by block size.");
3738 "must be divisible by the square of block size." );
3744 const std::string descriptorName{
"ComparisonQueueDescriptor"};
3746 ValidateNumInputs(workloadInfo, descriptorName, 2);
3747 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3753 ValidateBroadcastTensorShapesMatch(inputTensorInfo0,
3768 const std::string descriptorName{
"ElementwiseBinaryQueueDescriptor"};
3770 ValidateNumInputs(workloadInfo, descriptorName, 2);
3771 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3777 std::vector<DataType> supportedTypes =
3788 ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName);
3789 ValidateDataTypes(inputTensorInfo1, supportedTypes, descriptorName);
3791 ValidateTensorDataTypesMatch(inputTensorInfo0, outputTensorInfo, descriptorName,
"input",
"output");
3792 ValidateTensorDataTypesMatch(inputTensorInfo1, outputTensorInfo, descriptorName,
"input",
"output");
3797 const std::string descriptorName{
"ElementwiseUnaryQueueDescriptor"};
3799 ValidateNumInputs(workloadInfo, descriptorName, 1);
3800 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3805 ValidateTensorShapesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
3807 std::vector<DataType> supportedTypes =
3818 std::vector<DataType> logicalSupportedTypes =
3825 ValidateDataTypes(inputTensorInfo, logicalSupportedTypes, descriptorName);
3829 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
3833 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
3838 const std::string descriptorName{
"RankQueueDescriptor"};
3840 ValidateNumInputs(workloadInfo, descriptorName, 1);
3841 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3847 ValidateTensorNumElements(outputTensorInfo, descriptorName, 1,
"output");
3849 std::vector<DataType> supportedTypes =
3861 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
3867 const std::string descriptorName{
"LogicalBinaryQueueDescriptor"};
3869 ValidateNumInputs(workloadInfo, descriptorName, 2);
3870 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3876 ValidateBroadcastTensorShapesMatch(inputTensorInfo0,
3901 const std::string descriptorName{
"ReduceQueueDescriptor"};
3903 ValidateNumInputs(workloadInfo, descriptorName, 1);
3904 ValidateNumOutputs(workloadInfo, descriptorName, 1);
3909 std::vector<DataType> supportedTypes =
3920 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
3921 ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName,
"input",
"output");
3928 const std::string descriptorName{
"UnidirectionalSequenceLstmQueueDescriptor"};
3940 std::vector<DataType> supportedTypes =
3947 ValidateDataTypes(workloadInfo.
m_InputTensorInfos[0], supportedTypes, descriptorName);
3961 unsigned int batchIndx = 0;
3962 unsigned int inputIndx = 1;
3963 uint32_t timeStep = 1;
3964 unsigned int timeIndx = 1;
3984 descriptorName +
" input_0");
3987 descriptorName +
" input_1");
3990 descriptorName +
" input_2");
3994 descriptorName +
" output_0");
4000 (n_cell * n_input),
"InputLayerNormWeights");
4005 (n_cell * n_input),
"InputToForgetWeights");
4009 (n_cell * n_input),
"InputToCellWeights");
4014 (n_cell * n_output),
"RecurrentToInputWeights");
4019 (n_cell * n_output),
"RecurrentToForgetWeights");
4023 (n_cell * n_output),
"RecurrentToCellWeights");
4031 if (!cifg_weights_all_or_none)
4034 "RecurrentToInputWeights must either both be present (regular LSTM) "
4035 "or both not present (CIFG-LSTM). In addition CifgEnable must be set "
4042 n_cell,
"CellToInputWeights");
4047 n_cell,
"CellToForgetWeights");
4052 n_cell,
"CellToOutputWeights");
4056 bool peephole_weights_all_or_none =
4061 if (!peephole_weights_all_or_none)
4079 "must be present.");
4082 n_cell,
"InputGateBias");
4088 ValidatePointer(
m_CellBias,
"Null pointer check",
"CellBias");
4097 (n_cell * n_output),
"ProjectionWeights");
4114 if (!projecton_tensors_consistent)
4147 "disabled but InputLayerNormWeights are not present");
4150 1, n_cell,
"InputLayerNormWeights");
4159 "ForgetLayerNormWeights");
4163 "OutputLayerNormWeights");
4167 "CellLayerNormWeights");
4173 "normalisation weights are present.");
4179 const std::string descriptorName{
"BatchMatMulDescriptor"};
4181 ValidateNumInputs(workloadInfo, descriptorName, 2);
4182 ValidateNumOutputs(workloadInfo, descriptorName, 1);
4193 std::vector<DataType> supportedTypes =
4203 ValidateDataTypes(inputXInfoBeforeParams, supportedTypes, descriptorName);
4204 ValidateDataTypes(inputYInfoBeforeParams, supportedTypes, descriptorName);
4205 ValidateDataTypes(outputInfo, supportedTypes, descriptorName);
4207 if ((inputXInfoBeforeParams.GetNumDimensions() < 2) ||
4208 (inputYInfoBeforeParams.GetNumDimensions() < 2))
4220 ": Invalid descriptor parameters - Transpose and Adjoint "
4221 "cannot both be true for a given input tensor.");
4228 inputXInfoBeforeParams.GetShape()));
4233 inputXInfoBeforeParams.GetShape());
4234 if(inputXInfoBeforeParams.GetShape()[axesToMul.first] !=
4235 inputXInfoBeforeParams.GetShape()[axesToMul.second])
4238 ": Adjoint is set to true for input tensor X, but the axes to be adjointed are not square." );
4241 inputXInfoAfterParams = inputXInfoBeforeParams;
4245 inputXInfoAfterParams = inputXInfoBeforeParams;
4253 inputYInfoBeforeParams.GetShape()));
4258 inputYInfoBeforeParams.GetShape());
4259 if(inputYInfoBeforeParams.GetShape()[axesToMul.first] !=
4260 inputYInfoBeforeParams.GetShape()[axesToMul.second])
4263 ": Adjoint is set to true for input tensor Y, but the axes to be adjointed are not square." );
4266 inputYInfoAfterParams = inputYInfoBeforeParams;
4270 inputYInfoAfterParams = inputYInfoBeforeParams;
4280 ": Input tensor X does not have the correct "
4281 "number of dimensions for the Data Layout that it has been assigned.");
4297 ": Input tensor Y does not have the correct "
4298 "number of dimensions for the Data Layout that it has been assigned.");
4310 inputYInfoBeforeParams.GetShape());
4312 if(inputXInfoAfterParams.
GetShape()[axesXToMul.second]
4313 != inputYInfoAfterParams.
GetShape()[axesYToMul.first])
4316 ": The final axis of input tensor X must be the same size as "
4317 "the second last axis of input tensor Y.");
4330 ": Invalid input tensor data layout combination.");
4338 ": Invalid input tensor data layout combination.");
4344 unsigned int outputTensorDimSize = std::max(inputXInfoAfterParams.
GetNumDimensions(),
4346 if(outputTensorDimSize-2 > 0)
4355 auto doAxisExtension = [&](std::vector<unsigned int> axisIndices,
TensorInfo& ti)
4357 auto sizeDiff = (outputTensorDimSize-2) - axisIndices.size();
4359 for(
unsigned int i = 0; i < sizeDiff; i++)
4361 axisIndices.insert(axisIndices.begin(), 1);
4364 for(
unsigned int i = 0; i < ti.GetNumDimensions(); i++)
4366 ti.GetShape()[i] = inputXInfoAfterParams.
GetShape()[i];
4375 doAxisExtension(axesXNotMul, tiXNotMul);
4376 doAxisExtension(axesYNotMul, tiYNotMul);
4384 ValidateBroadcastTensorShapesMatch(tiXNotMul,
4395 const std::string& descriptorName{
"TileQueueDescriptor"};
4397 ValidateNumInputs(workloadInfo, descriptorName, 1);
4398 ValidateNumOutputs(workloadInfo, descriptorName, 1);
4403 std::vector<DataType> supportedTypes =
4418 ": Multiples length is not same as the number of dimensions in Input.");
4421 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
4422 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
4427 const std::string& descriptorName{
"BroadcastToQueueDescriptor"};
4429 ValidateNumInputs(workloadInfo, descriptorName, 1);
4430 ValidateNumOutputs(workloadInfo, descriptorName, 1);
4435 std::vector<DataType> supportedTypes =
4447 ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
4448 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
4453 const std::string& descriptorName{
"ScatterQueueDescriptor"};
4455 ValidateNumInputs(workloadInfo, descriptorName, 3);
4456 ValidateNumOutputs(workloadInfo, descriptorName, 1);
4463 std::vector<DataType> supportedTypes =
4474 std::vector<DataType> indicesSupportedTypes =
4481 ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName);
4485 ValidateDataTypes(inputTensorInfo0, indicesSupportedTypes, descriptorName);
4488 ValidateDataTypes(inputTensorInfo1, indicesSupportedTypes, descriptorName);
4489 ValidateDataTypes(inputTensorInfo2, supportedTypes, descriptorName);
4490 ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);