code: def _count_docs_with_term(
      term_frequency: tf.SparseTensor,
  ) -> tf.Tensor:
      """Computes the number of documents in a batch that contain each term.
  
      Args:
        term_frequency: The `SparseTensor` output of _to_term_frequency.
  
      Returns:
        A `Tensor` of shape (vocab_size,) that contains the number of documents in
        the batch that contain each term.
      """
      count_of_doc_inter = tf.SparseTensor(
          indices=term_frequency.indices,
          values=tf.ones_like(term_frequency.values),
          dense_shape=term_frequency.dense_shape,
      )
      return tf.sparse.reduce_sum(
          count_of_doc_inter, axis=0, keepdims=True
      )
  
imports: import os
  from typing import Any, Callable, Iterable, Optional, Tuple, Union
  import tensorflow
  from tensorflow_transform import analyzers
  from tensorflow_transform import common
  from tensorflow_transform import common_types
  from tensorflow_transform import gaussianization
  from tensorflow_transform import schema_inference
  from tensorflow_transform import tf_utils
  from tfx_bsl.types import tfx_namedtuple
label_desc: Use image node_id 17 for calling a global function with example usage: _count_docs_with_term(term_frequency) and returns: tf