def _trace_and_get_metadata(
    concrete_transform_fn: function.ConcreteFunction,
    structured_inputs: Mapping[str, common_types.TensorType],
    preprocessing_fn: Callable[
        [Mapping[str, common_types.TensorType]],
        Mapping[str, common_types.TensorType],
    ],
    base_temp_dir: Optional[str],
    tensor_replacement_map: Optional[Dict[str, tf.Tensor]],
) -> dataset_metadata.DatasetMetadata:
  """Compute and return metadata for the outputs of `concrete_transform_fn`."""
  tf_graph_context = graph_context.TFGraphContext(
      module_to_export=tf.Module(),
      temp_dir=base_temp_dir,
      evaluated_replacements=tensor_replacement_map,
  )
  concrete_metadata_fn = schema_inference.get_traced_metadata_fn(
      preprocessing_fn,
      structured_inputs,
      tf_graph_context,
      evaluate_schema_overrides=True,
  )
  return dataset_metadata.DatasetMetadata(
      schema=schema_inference.infer_feature_schema_v2(
          concrete_transform_fn.structured_outputs,
          concrete_metadata_fn,
          evaluate_schema_overrides=True,
      )
  )
Compute and return metadata for the outputs of `concrete_transform_fn`.
tensorflow_transform/impl_helper.py