tensorflow/core/tpu/graph_rewrite/tpu_embedding_software_deduplication_rewrite_pass.cc
// Check the number of outputs for RecvActivationsNode or for number of inputs
// For SendGradientsNode.
Check the number of outputs for RecvActivationsNode or for number of inputs
For SendGradientsNode.
Check the number of outputs for RecvActivationsNode or for number of inputs For SendGradientsNode .
xla::Status CheckNumInputsOrOutputs(
    const int32 num_input_or_outputs, const std::string& attribute_name,
    const std::string& node_name,
    const tpu::TPUEmbeddingConfiguration& tpu_embedding_config) {
  if (tpu_embedding_config.feature_descriptor_size() == 0 &&
      num_input_or_outputs != tpu_embedding_config.table_descriptor_size()) {
    return errors::InvalidArgument(absl::StrFormat(
        "Number of tables in the TPU embedding config: %d does not match the "
        "%s attribute: %d in the %s node.",
        tpu_embedding_config.table_descriptor_size(), attribute_name,
        num_input_or_outputs, node_name));
  }
  if (tpu_embedding_config.feature_descriptor_size() > 0 &&
      num_input_or_outputs != tpu_embedding_config.feature_descriptor_size()) {
    return errors::InvalidArgument(absl::StrFormat(
        "Feature descriptor is set in tpu embedding config. But number of "
        "features in the TPU embedding config: %d does not match the "
        "%s attribute: %d in the %s node.",
        tpu_embedding_config.feature_descriptor_size(), attribute_name,
        num_input_or_outputs, node_name));
  }
  return Status::OK();
}
xla :: Status CheckNumInputsOrOutputs ( const int32 num_input_or_outputs , const std :: string & attribute_name , const std :: string & node_name , const tpu :: TPUEmbeddingConfiguration & tpu_embedding_config ) { if ( tpu_embedding_config . feature_descriptor_size ( ) == 0 && num_input_or_outputs != tpu_embedding_config . table_descriptor_size ( ) ) { return errors :: InvalidArgument ( absl :: StrFormat ( " " " " , tpu_embedding_config . table_descriptor_size ( ) , attribute_name , num_input_or_outputs , node_name ) ) ; } if ( tpu_embedding_config . feature_descriptor_size ( ) > 0 && num_input_or_outputs != tpu_embedding_config . feature_descriptor_size ( ) ) { return errors :: InvalidArgument ( absl :: StrFormat ( " " " " " " , tpu_embedding_config . feature_descriptor_size ( ) , attribute_name , num_input_or_outputs , node_name ) ) ; } return Status :: OK ( ) ; }
Check the number of outputs for RecvActivationsNode or for number of inputs
For SendGradientsNode.
Check the number of outputs for RecvActivationsNode or for number of inputs For SendGradientsNode .