getInputIndex method

int getInputIndex(
  1. String opName
)

Gets index of an input given the op name of the input.

Implementation

int getInputIndex(String opName) {
  final inputTensors = getInputTensors();
  var inputTensorsIndex = <String, int>{};
  for (var i = 0; i < inputTensors.length; i++) {
    inputTensorsIndex[inputTensors[i].name] = i;
  }
  if (inputTensorsIndex.containsKey(opName)) {
    return inputTensorsIndex[opName]!;
  } else {
    throw ArgumentError(
        "Input error: $opName' is not a valid name for any input. Names of inputs and their indexes are $inputTensorsIndex");
  }
}