tensorflow/compiler/xla/service/hlo_proto_util.cc
// Returns the entry computation of the HLO module in the given HloProto.
Returns the entry computation of the HLO module in the given HloProto.
Returns the entry computation of the HLO module in the given HloProto .
StatusOr<const HloComputationProto*> GetEntryComputation(
    const HloProto& hlo_proto) {
  if (!hlo_proto.has_hlo_module()) {
    return NotFound("HloProto missing HloModuleProto.");
  }
  if (hlo_proto.hlo_module().entry_computation_name().empty()) {
    return NotFound("HloProto has empty entry computation name.");
  }
  const string& entry_computation_name =
      hlo_proto.hlo_module().entry_computation_name();
  const HloComputationProto* entry_computation = nullptr;
  for (const HloComputationProto& computation :
       hlo_proto.hlo_module().computations()) {
    if (computation.name() == entry_computation_name) {
      if (entry_computation == nullptr) {
        entry_computation = &computation;
      } else {
        return InvalidArgument(
            "HloProto has multiple computations with entry computation named "
            "%s.",
            entry_computation_name.c_str());
      }
    }
  }
  if (entry_computation == nullptr) {
    return InvalidArgument("HloProto has no entry computation named %s.",
                           entry_computation_name.c_str());
  }
  return entry_computation;
}
StatusOr < const HloComputationProto * > GetEntryComputation ( const HloProto & hlo_proto ) { if ( ! hlo_proto . has_hlo_module ( ) ) { return NotFound ( " " ) ; } if ( hlo_proto . hlo_module ( ) . entry_computation_name ( ) . empty ( ) ) { return NotFound ( " " ) ; } const string & entry_computation_name = hlo_proto . hlo_module ( ) . entry_computation_name ( ) ; const HloComputationProto * entry_computation = nullptr ; for ( const HloComputationProto & computation : hlo_proto . hlo_module ( ) . computations ( ) ) { if ( computation . name ( ) == entry_computation_name ) { if ( entry_computation == nullptr ) { entry_computation = & computation ; } else { return InvalidArgument ( " " " " , entry_computation_name . c_str ( ) ) ; } } } if ( entry_computation == nullptr ) { return InvalidArgument ( " " , entry_computation_name . c_str ( ) ) ; } return entry_computation ; }
Returns the entry computation of the HLO module in the given HloProto.
Returns the entry computation of the HLO module in the given HloProto .