code: def generate_synthetic_data(
      input_shape,
      input_value=0,
      input_dtype=None,
      label_shape=None,
      label_value=0,
      label_dtype=None,
  ):
      """Create a repeating dataset with constant values.
  
      Args:
        input_shape: a tf.TensorShape object or nested tf.TensorShapes. The shape of
          the input data.
        input_value: Value of each input element.
        input_dtype: Input dtype. If None, will be inferred by the input value.
        label_shape: a tf.TensorShape object or nested tf.TensorShapes. The shape of
          the label data.
        label_value: Value of each input element.
        label_dtype: Input dtype. If None, will be inferred by the target value.
  
      Returns:
        Dataset of tensors or tuples of tensors (if label_shape is set).
      """
      # TODO(kathywu): Replace with SyntheticDataset once it is in contrib.
      element = input_element = nest.map_structure(
          lambda s: tf.constant(input_value, input_dtype, s),
          input_shape,
      )
  
      if label_shape:
          label_element = nest.map_structure(
              lambda s: tf.constant(label_value, label_dtype, s),
              label_shape,
          )
          element = (input_element, label_element)
  
      return tf.data.Dataset.from_tensors(element).repeat()
  
file_path: autodist/examples/benchmark/utils/misc/model_helpers.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numbers
  import tensorflow
  from tensorflow.python.util import nest
label_desc: Use image node_id 2 for calling a global function with example usage: generate_synthetic_data(input_shape, input_value, input_dtype, label_shape, label_value, label_dtype) and returns: tf