code: def make_dense_bow_model(
      layer_generator: type_aliases.LayerGenerator,
      input_dims: Sequence[int],
      output_dims: Sequence[int],
  ) -> tf.keras.Model:
      """Creates an embedding bow model with a `Dense` layer."""
      inputs = tf.keras.Input(shape=input_dims, dtype=tf.int32)
      # For the Embedding layer, input_dim is the vocabulary size. This should
      # be distinguished from the input_dim argument, which is the number of ids
      # in eache example.
      emb_layer = layer_generator(input_dims, output_dims)
      if len(output_dims) != 1:
          raise ValueError("Expected `output_dims` to be of size 1.")
      feature_embs = emb_layer(inputs)
      # Embeddings add one extra dimension to its inputs, which combined with the
      # batch dimension at dimension 0, equals two additional dimensions compared
      # to the number of input dimensions. Here, we want to reduce over the output
      # space, but exclude the batch dimension.
      reduction_axes = range(1, len(input_dims) + 2)
      example_embs = tf.expand_dims(
          tf.reduce_sum(feature_embs, axis=reduction_axes), axis=-1
      )
      outputs = tf.keras.layers.Dense(1)(example_embs)
      return tf.keras.Model(inputs=inputs, outputs=outputs)
  
imports: from collections.abc import Callable, MutableSequence, Sequence
  from typing import Optional
  import numpy
  import tensorflow
  import tensorflow.compat.v2
  from tensorflow_privacy.privacy.fast_gradient_clipping import clip_grads
  from tensorflow_privacy.privacy.fast_gradient_clipping import layer_registry
  from tensorflow_privacy.privacy.fast_gradient_clipping import type_aliases
label_desc: Use image node_id 14 for calling a global function with example usage: make_dense_bow_model(layer_generator, input_dims, output_dims) and returns: tf