New! Use Simple ML for Sheets to apply machine learning to the data in your Google Sheets Read More


Stay organized with collections Save and categorize content based on your preferences.

Creates a DataHandler, providing standardized access to a Dataset.

See DataHandler for the list and definition of the arguments. See the implementation of, evaluate(), or predict() methods for complete usage examples. As a rule of tumb, get_data_handler() accepts the same inputs as the x argument of


  def step(iterator):
    data = next(iterator)
    # result <= Do something with data
    return result
  tf_step = tf.function(step, reduce_retracing=True)

  # Assume x is a Dataset.
  data_handler = data_adapter.get_data_handler(x=x)
  # Epoch iteration
  for epo_idx, iterator in data_handler.enumerate_epochs():
      # Stop on dataset exhaustion.
      with data_handler.catch_stop_iteration():
        for step in data_handler.steps(): # Step iteration
            step_result = step(iterator)

*args Arguments passed to the DataHandler constructor.
**kwargs Arguments passed to the DataHandler constructor.

A DataHandler object. If the model's cluster coordinate is set (e.g. the model was defined under a parameter-server strategy), returns a _ClusterCoordinatorDataHandler.