tensorflow/compiler/xla/service/hlo_proto_util.cc
// Returns the root instruction of the given computation proto.
Returns the root instruction of the given computation proto.
Returns the root instruction of the given computation proto .
StatusOr<const HloInstructionProto*> GetRootInstruction(
    const HloComputationProto& computation) {
  if (computation.root_name().empty()) {
    return InvalidArgument("Missing root instruction name.");
  }
  const HloInstructionProto* root = nullptr;
  for (const HloInstructionProto& instruction : computation.instructions()) {
    if (instruction.name() == computation.root_name()) {
      if (root == nullptr) {
        root = &instruction;
      } else {
        return InvalidArgument(
            "Computation has multiple instructions named %s.",
            computation.root_name().c_str());
      }
    }
  }
  if (root == nullptr) {
    return InvalidArgument("Computation has no instruction named %s.",
                           computation.root_name().c_str());
  }
  return root;
}
StatusOr < const HloInstructionProto * > GetRootInstruction ( const HloComputationProto & computation ) { if ( computation . root_name ( ) . empty ( ) ) { return InvalidArgument ( " " ) ; } const HloInstructionProto * root = nullptr ; for ( const HloInstructionProto & instruction : computation . instructions ( ) ) { if ( instruction . name ( ) == computation . root_name ( ) ) { if ( root == nullptr ) { root = & instruction ; } else { return InvalidArgument ( " " , computation . root_name ( ) . c_str ( ) ) ; } } } if ( root == nullptr ) { return InvalidArgument ( " " , computation . root_name ( ) . c_str ( ) ) ; } return root ; }
Returns the root instruction of the given computation proto.
Returns the root instruction of the given computation proto .