class_docstr: A CIFAR-10 data provider.
docstr: See `data.Provider` get_input_fn.
docstr_tok: ["See","`","data.Provider","`","get_input_fn","."]
code: def get_input_fn(
      self, partition, mode, batch_size, preprocess=True, use_tpu=False
  ):
      """See `data.Provider` get_input_fn."""
  
      def input_fn(params=None):
          """Provides batches of CIFAR images.
  
          Args:
            params: A dict containing the batch_size on TPU, otherwise None.
  
          Returns:
            images: A `Tensor` of size [batch_size, 32, 32, 3]
            labels: A `Tensor` of size [batch_size, 1],
          """
  
          batch_size_ = batch_size
          if use_tpu:
              batch_size_ = params.get("batch_size", batch_size)
  
          training = mode == tf.estimator.ModeKeys.TRAIN
          dataset = self._cifar10_dataset(partition)
          dataset = dataset.map(
              functools.partial(
                  self._preprocess_data,
                  training=training,
                  preprocess=preprocess,
              )
          )
          if training:
              dataset = dataset.apply(
                  tf.contrib.data.shuffle_and_repeat(
                      buffer_size=500, seed=self._seed
                  )
              )
          return (
              dataset.batch(batch_size_, drop_remainder=use_tpu)
              .prefetch(tf.data.experimental.AUTOTUNE)
              .make_one_shot_iterator()
              .get_next()
          )
  
      return input_fn
  
file_path: adanet/research/improve_nas/trainer/cifar10.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import numpy
  import tensorflow.compat.v1
  from tensorflow.keras.datasets import cifar10
label_desc: Use image node_id 5 for calling the Provider obj's underlying member method code with example usage: obj.get_input_fn(partition, mode, batch_size, preprocess, use_tpu) and returns: input_fn, dataset