code: def input_fn_raw(
      tf_transform_output, raw_examples_pattern, batch_size
  ):
      """An input function reading from raw data, converting to model input.
  
      Args:
        tf_transform_output: Wrapper around output of tf.Transform.
        raw_examples_pattern: Base filename of examples.
        batch_size: Batch size.
  
      Returns:
        The input data for training or eval, in the form of k.
      """
  
      def get_ordered_raw_data_dtypes():
          result = []
          for col in common.ORDERED_CSV_COLUMNS:
              if col not in common.RAW_DATA_FEATURE_SPEC:
                  result.append(0.0)
                  continue
              spec = common.RAW_DATA_FEATURE_SPEC[col]
              if isinstance(spec, tf.io.FixedLenFeature):
                  result.append(spec.dtype)
              else:
                  result.append(0.0)
          return result
  
      dataset = tf.data.experimental.make_csv_dataset(
          file_pattern=raw_examples_pattern,
          batch_size=batch_size,
          column_names=common.ORDERED_CSV_COLUMNS,
          column_defaults=get_ordered_raw_data_dtypes(),
          prefetch_buffer_size=0,
          ignore_errors=True,
      )
  
      tft_layer = tf_transform_output.transform_features_layer()
  
      def transform_dataset(data):
          raw_features = {}
          for key, val in data.items():
              if key not in common.RAW_DATA_FEATURE_SPEC:
                  continue
              if isinstance(
                  common.RAW_DATA_FEATURE_SPEC[key], tf.io.RaggedFeature
              ):
                  # make_csv_dataset will set the value to 0 when it's missing.
                  raw_features[key] = tf.RaggedTensor.from_tensor(
                      tf.expand_dims(val, axis=-1), padding=0
                  )
                  continue
              raw_features[key] = val
          transformed_features = tft_layer(raw_features)
          data_labels = transformed_features.pop(common.LABEL_KEY)
          return (transformed_features, data_labels)
  
      return dataset.map(
          transform_dataset,
          num_parallel_calls=tf.data.experimental.AUTOTUNE,
      ).prefetch(tf.data.experimental.AUTOTUNE)
  
file_path: transform/examples/census_example_v2.py
imports: import math
  import os
  import pprint
  import tempfile
  from absl import logging
  import tensorflow
  import tensorflow_transform
  import census_example_common
  from tensorflow_transform.keras_lib import tf_keras
label_desc: Use image node_id 2 for calling a global function with example usage: input_fn_raw(tf_transform_output, raw_examples_pattern, batch_size) and returns: dataset, result, transformed_features,  data_labels