code: def create_dataset_from_data_producer(producer, params):
      """Return dataset online-generating data."""
  
      def preprocess_train_input(features, labels):
          """Pre-process the training data.
  
          This is needed because
          - The label needs to be extended to be used in the loss fn
          - We need the same inputs for training and eval so adding fake inputs
            for DUPLICATE_MASK in training data.
  
          Args:
            features: Dictionary of features for training.
            labels: Training labels.
  
          Returns:
            Processed training features.
          """
          fake_dup_mask = tf.zeros_like(features[movielens.USER_COLUMN])
          features[rconst.DUPLICATE_MASK] = fake_dup_mask
          features[rconst.TRAIN_LABEL_KEY] = labels
          return features
  
      train_input_fn = producer.make_input_fn(is_training=True)
      train_input_dataset = train_input_fn(params).map(
          preprocess_train_input
      )
  
      def preprocess_eval_input(features):
          """Pre-process the eval data.
  
          This is needed because:
          - The label needs to be extended to be used in the loss fn
          - We need the same inputs for training and eval so adding fake inputs
            for VALID_PT_MASK in eval data.
  
          Args:
            features: Dictionary of features for evaluation.
  
          Returns:
            Processed evaluation features.
          """
          labels = tf.cast(
              tf.zeros_like(features[movielens.USER_COLUMN]), tf.bool
          )
          fake_valid_pt_mask = tf.cast(
              tf.zeros_like(features[movielens.USER_COLUMN]), tf.bool
          )
          features[rconst.VALID_POINT_MASK] = fake_valid_pt_mask
          features[rconst.TRAIN_LABEL_KEY] = labels
          return features
  
      eval_input_fn = producer.make_input_fn(is_training=False)
      eval_input_dataset = eval_input_fn(params).map(
          preprocess_eval_input
      )
  
      return train_input_dataset, eval_input_dataset
  
file_path: autodist/examples/benchmark/utils/recommendation/ncf_input_pipeline.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import tensorflow.compat.v2
  from utils.recommendation import constants
  from utils.recommendation import movielens
  from utils.recommendation import data_pipeline
label_desc: Use image node_id 2 for calling a global function with example usage: create_dataset_from_data_producer(producer, params) and returns: train_input_dataset,  eval_input_dataset, features, features