code: def make_input_fn(
      data_df, label_df, mode, batch_size=-1, batch_per_thread=-1
  ):
      if mode == tf.estimator.ModeKeys.TRAIN:
  
          def input_function():
              ds = tf.data.Dataset.from_tensor_slices(
                  (dict(data_df), label_df)
              )
              ds = ds.shuffle(1000)
              ds = TFDataset.from_tf_data_dataset(
                  dataset=ds, batch_size=batch_size
              )
              return ds
  
      elif mode == tf.estimator.ModeKeys.EVAL:
  
          def input_function():
              ds = tf.data.Dataset.from_tensor_slices(
                  (dict(data_df), label_df)
              )
              ds = TFDataset.from_tf_data_dataset(
                  dataset=ds, batch_per_thread=batch_per_thread
              )
              return ds
  
      else:
  
          def input_function():
              ds = tf.data.Dataset.from_tensor_slices((dict(data_df),))
              ds = TFDataset.from_tf_data_dataset(
                  dataset=ds,
                  batch_size=batch_size,
                  batch_per_thread=batch_per_thread,
              )
              return ds
  
      return input_function
  
file_path: analytics-zoo/pyzoo/zoo/examples/tensorflow/tfpark/estimator/pre-made-estimator.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import os
  import sys
  import pandas
  import tensorflow
  from optparse import OptionParser
  from tensorflow_estimator.python.estimator.canned import prediction_keys
  from zoo import init_nncontext
  from zoo.tfpark import TFDataset, TFEstimator
  from zoo.tfpark import ZooOptimizer
label_desc: Use image node_id 1 for calling a global function with example usage: make_input_fn(data_df, label_df, mode, batch_size, batch_per_thread) and returns: input_function, ds, ds, ds