def create_dataset_from_data_producer(producer, params):
    'Return dataset online-generating data.'

    def preprocess_train_input(features, labels):
        'Pre-process the training data.\n\n        This is needed because\n        - The label needs to be extended to be used in the loss fn\n        - We need the same inputs for training and eval so adding fake inputs\n          for DUPLICATE_MASK in training data.\n\n        Args:\n          features: Dictionary of features for training.\n          labels: Training labels.\n\n        Returns:\n          Processed training features.\n        '
        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.\n\n        This is needed because:\n        - The label needs to be extended to be used in the loss fn\n        - We need the same inputs for training and eval so adding fake inputs\n          for VALID_PT_MASK in eval data.\n\n        Args:\n          features: Dictionary of features for evaluation.\n\n        Returns:\n          Processed evaluation features.\n        '
        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)
Return dataset online-generating data.
def create_dataset_from_data_producer(producer, params):
    

    def preprocess_train_input(features, labels):
        'Pre-process the training data.\n\n        This is needed because\n        - The label needs to be extended to be used in the loss fn\n        - We need the same inputs for training and eval so adding fake inputs\n          for DUPLICATE_MASK in training data.\n\n        Args:\n          features: Dictionary of features for training.\n          labels: Training labels.\n\n        Returns:\n          Processed training features.\n        '
        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.\n\n        This is needed because:\n        - The label needs to be extended to be used in the loss fn\n        - We need the same inputs for training and eval so adding fake inputs\n          for VALID_PT_MASK in eval data.\n\n        Args:\n          features: Dictionary of features for evaluation.\n\n        Returns:\n          Processed evaluation features.\n        '
        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)