tensorflow/core/tfrt/saved_model/saved_model.cc
// Gets the signatures from `signature_defs` and inserts them into `signatures`.
Gets the signatures from `signature_defs` and inserts them into `signatures`.
Gets the signatures from ` signature_defs ` and inserts them into ` signatures ` .
void GetSignaturesFromSignatureDef(
    SignatureMap& signatures,
    const google::protobuf::Map<std::string, tensorflow::SignatureDef>& signature_defs,
    const SavedModel::Options& options) {
  for (const auto& p : signature_defs) {
    const std::string& signature_name = p.first;
    const tensorflow::SignatureDef& signature_def = p.second;
    DCHECK(signatures.find(signature_name) == signatures.end());
    auto& signature = signatures[signature_name];
    signature.input_names.reserve(signature_def.inputs().size());
    signature.input_specs.reserve(signature_def.inputs().size());
    for (const auto& p : signature_def.inputs()) {
      const std::string& input_tensor_name = p.first;
      const tensorflow::TensorInfo& tensor_info = p.second;
      signature.input_names.push_back(input_tensor_name);
      signature.input_specs.push_back(
          TensorSpec(tensor_info.dtype(), tensor_info.tensor_shape()));
    }
    signature.input_devices = std::vector<std::string>(
        signature_def.inputs().size(),
        options.graph_execution_options.compile_options.default_device);
    signature.output_names.reserve(signature_def.outputs().size());
    signature.output_specs.reserve(signature_def.outputs().size());
    for (const auto& p : signature_def.outputs()) {
      const std::string& output_tensor_name = p.first;
      const tensorflow::TensorInfo& tensor_info = p.second;
      signature.output_names.push_back(output_tensor_name);
      signature.output_specs.push_back(
          TensorSpec(tensor_info.dtype(), tensor_info.tensor_shape()));
    }
  }
}
void GetSignaturesFromSignatureDef ( SignatureMap & signatures , const google :: protobuf :: Map < std :: string , tensorflow :: SignatureDef > & signature_defs , const SavedModel :: Options & options ) { for ( const auto & p : signature_defs ) { const std :: string & signature_name = p . first ; const tensorflow :: SignatureDef & signature_def = p . second ; DCHECK ( signatures . find ( signature_name ) == signatures . end ( ) ) ; auto & signature = signatures [ signature_name ] ; signature . input_names . reserve ( signature_def . inputs ( ) . size ( ) ) ; signature . input_specs . reserve ( signature_def . inputs ( ) . size ( ) ) ; for ( const auto & p : signature_def . inputs ( ) ) { const std :: string & input_tensor_name = p . first ; const tensorflow :: TensorInfo & tensor_info = p . second ; signature . input_names . push_back ( input_tensor_name ) ; signature . input_specs . push_back ( TensorSpec ( tensor_info . dtype ( ) , tensor_info . tensor_shape ( ) ) ) ; } signature . input_devices = std :: vector < std :: string > ( signature_def . inputs ( ) . size ( ) , options . graph_execution_options . compile_options . default_device ) ; signature . output_names . reserve ( signature_def . outputs ( ) . size ( ) ) ; signature . output_specs . reserve ( signature_def . outputs ( ) . size ( ) ) ; for ( const auto & p : signature_def . outputs ( ) ) { const std :: string & output_tensor_name = p . first ; const tensorflow :: TensorInfo & tensor_info = p . second ; signature . output_names . push_back ( output_tensor_name ) ; signature . output_specs . push_back ( TensorSpec ( tensor_info . dtype ( ) , tensor_info . tensor_shape ( ) ) ) ; } } }
Gets the signatures from `signature_defs` and inserts them into `signatures`.
Gets the signatures from ` signature_defs ` and inserts them into ` signatures ` .