getOutputIndex method

int getOutputIndex(
  1. String opName
)

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

Implementation

int getOutputIndex(String opName) {
  final outputTensors = getOutputTensors();
  var outputTensorsIndex = <String, int>{};
  for (var i = 0; i < outputTensors.length; i++) {
    outputTensorsIndex[outputTensors[i].name] = i;
  }
  if (outputTensorsIndex.containsKey(opName)) {
    return outputTensorsIndex[opName]!;
  } else {
    throw ArgumentError(
        "Output error: $opName' is not a valid name for any output. Names of outputs and their indexes are $outputTensorsIndex");
  }
}