def get_synth_input_fn(height, width, num_channels, num_classes, dtype=tf.float32, drop_remainder=True):
    'Returns an input function that returns a dataset with random data.\n\n  This input_fn returns a data set that iterates over a set of random data and\n  bypasses all preprocessing, e.g. jpeg decode and copy. The host to device\n  copy is still included. This used to find the upper throughput bound when\n  tuning the full input pipeline.\n\n  Args:\n    height: Integer height that will be used to create a fake image tensor.\n    width: Integer width that will be used to create a fake image tensor.\n    num_channels: Integer depth that will be used to create a fake image tensor.\n    num_classes: Number of classes that should be represented in the fake labels\n      tensor\n    dtype: Data type for features/images.\n    drop_remainder: A boolean indicates whether to drop the remainder of the\n      batches. If True, the batch dimension will be static.\n\n  Returns:\n    An input_fn that can be used in place of a real one to return a dataset\n    that can be used for iteration.\n  '

    def input_fn(is_training, data_dir, batch_size, *args, **kwargs):
        'Returns dataset filled with random data.'
        (inputs, labels) = get_synth_data(height=height, width=width, num_channels=num_channels, num_classes=num_classes, dtype=dtype)
        labels = tf.cast(labels, dtype=tf.float32)
        data = tf.data.Dataset.from_tensors((inputs, labels)).repeat()
        data = data.batch(batch_size, drop_remainder=drop_remainder)
        data = data.prefetch(buffer_size=tf.data.experimental.AUTOTUNE)
        return data
    return input_fn
Returns an input function that returns a dataset with random data.

This input_fn returns a data set that iterates over a set of random data and
bypasses all preprocessing, e.g. jpeg decode and copy. The host to device
copy is still included. This used to find the upper throughput bound when
tuning the full input pipeline.

Args:
  height: Integer height that will be used to create a fake image tensor.
  width: Integer width that will be used to create a fake image tensor.
  num_channels: Integer depth that will be used to create a fake image tensor.
  num_classes: Number of classes that should be represented in the fake labels
    tensor
  dtype: Data type for features/images.
  drop_remainder: A boolean indicates whether to drop the remainder of the
    batches. If True, the batch dimension will be static.

Returns:
  An input_fn that can be used in place of a real one to return a dataset
  that can be used for iteration.
def get_synth_input_fn(height, width, num_channels, num_classes, dtype=tf.float32, drop_remainder=True):
    'Returns an input function that returns a dataset with random data.\n\n  This input_fn returns a data set that iterates over a set of random data and\n  bypasses all preprocessing, e.g. jpeg decode and copy. The host to device\n  copy is still included. This used to find the upper throughput bound when\n  tuning the full input pipeline.\n\n  Args:\n    height: Integer height that will be used to create a fake image tensor.\n    width: Integer width that will be used to create a fake image tensor.\n    num_channels: Integer depth that will be used to create a fake image tensor.\n    num_classes: Number of classes that should be represented in the fake labels\n      tensor\n    dtype: Data type for features/images.\n    drop_remainder: A boolean indicates whether to drop the remainder of the\n      batches. If True, the batch dimension will be static.\n\n  Returns:\n    An input_fn that can be used in place of a real one to return a dataset\n    that can be used for iteration.\n  '

    def input_fn(is_training, data_dir, batch_size, *args, **kwargs):
        'Returns dataset filled with random data.'
        (inputs, labels) = get_synth_data(height=height, width=width, num_channels=num_channels, num_classes=num_classes, dtype=dtype)
        labels = tf.cast(labels, dtype=tf.float32)
        data = tf.data.Dataset.from_tensors((inputs, labels)).repeat()
        data = data.batch(batch_size, drop_remainder=drop_remainder)
        data = data.prefetch(buffer_size=tf.data.experimental.AUTOTUNE)
        return data
    return input_fn