code: def _fill_in_missing(x):
      """Replace missing values in a SparseTensor.
  
      Fills in missing values of `x` with '' or 0, and converts to a dense tensor.
  
      Args:
        x: A `SparseTensor` of rank 2.  Its dense shape should have size at most 1
          in the second dimension.
  
      Returns:
        A rank 1 tensor where missing values of `x` have been filled in.
      """
      if not isinstance(x, tf.sparse.SparseTensor):
          return x
  
      default_value = "" if x.dtype == tf.string else 0
      return tf.squeeze(
          tf.sparse.to_dense(
              tf.SparseTensor(
                  x.indices, x.values, [x.dense_shape[0], 1]
              ),
              default_value,
          ),
          axis=1,
      )
  
file_path: tfx/tfx/examples/chicago_taxi_pipeline/taxi_utils.py
imports: from typing import List
  import tensorflow
  from tensorflow import estimator
  import tensorflow_model_analysis
  import tensorflow_transform
  from tensorflow_transform.tf_metadata import schema_utils
  from tfx.components.trainer.fn_args_utils import DataAccessor
  from tfx_bsl.tfxio import dataset_options
label_desc: Use image node_id 4 for calling a global function with example usage: _fill_in_missing(x) and returns: tf, x