code: def default_dm_config(
      per_cluster_buffer_size: int,
      distance_to_cluster_threshold: float,
      bootstrap_steps: int = 1,
      min_variance: float = 0.01,
      max_num_clusters: int = None,
  ):
      """Creates a default DynamicMemoryConfig with GaussianMemoryConfig.
  
      Args:
        per_cluster_buffer_size: number of sampled points in each cluster.
        distance_to_cluster_threshold: the distance beyond which a new cluster is
          formed.
        bootstrap_steps: the minimal number of update steps to be run before any new
          clusters can be created.
        min_variance: minimal variance as a prior for each dimension.
        max_num_clusters: if set, the maximal number of clusters in a layer.
  
      Returns:
        A DynamicMemoryConfig.
      Raises:
        ValueError: if per_cluster_buffer_size,  distance_to_cluster_threshold or
        max_num_clusters is not positive.
      """
      if per_cluster_buffer_size <= 0:
          raise ValueError(
              "Invalid per_cluster_buffer_size: %d"
              % per_cluster_buffer_size
          )
      if distance_to_cluster_threshold <= 0:
          raise ValueError(
              "Invalid distance_to_cluster_threshold: %d"
              % distance_to_cluster_threshold
          )
      if max_num_clusters <= 0:
          raise ValueError(
              "Invalid max_num_clusters: {}".format(max_num_clusters)
          )
  
      config = de_config_pb2.DynamicEmbeddingConfig()
      text_format.Parse(
          """
      memory_store_config {
          extension {
            [type.googleapis.com/carls.memory_store.GaussianMemoryConfig] {
              per_cluster_buffer_size: %d
              distance_to_cluster_threshold: %f
              max_num_clusters: %d
              bootstrap_steps: %d
              min_variance: %f
              distance_type: CWISE_MEAN_GAUSSIAN
            }
          }
        }
    """
          % (
              per_cluster_buffer_size,
              distance_to_cluster_threshold,
              max_num_clusters,
              bootstrap_steps,
              min_variance,
          ),
          config,
      )
      return config
  
file_path: neural-structured-learning/research/carls/testing/test_util.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import typing
  from absl import flags
  from research.carls import dynamic_embedding_config_pb2
  from research.carls import kbs_server_helper_pybind
  from research.carls.candidate_sampling import candidate_sampler_config_pb2
  from google.protobuf import text_format
label_desc: Use image node_id 2 for calling a global function with example usage: default_dm_config(per_cluster_buffer_size, distance_to_cluster_threshold, bootstrap_steps, min_variance, max_num_clusters) and returns: config