(self)
return (enqueue_ops, dequeue_fn, all_hooks, run_infeed_loop_on_coordinator)
Generates infeed enqueue ops and dequeue_fn.
Generates infeed enqueue ops and dequeue_fn.
Generates infeed enqueue ops and dequeue_fn .
def generate_infeed_enqueue_ops_and_dequeue_fn(self):
    """Generates infeed enqueue ops and dequeue_fn."""
    # While tf.while_loop is called, the body function, which invokes
    # `enqueue_fn` passed in, is called to construct the graph. So, input_fn
    # structure is recorded.
    enqueue_ops, all_hooks, run_infeed_loop_on_coordinator = (
        self._invoke_input_fn_and_record_structure())

    self._validate_input_pipeline()

    def dequeue_fn():
      """dequeue_fn is used by TPU to retrieve the tensors."""
      # In the model-parallel case, both the host-side and device-side
      # computations must agree on the core on which infeed takes place. We
      # choose to perform infeed on logical core 0 of each replica.
      values = self._infeed_queue.generate_dequeue_op(tpu_device=0)
      # The unflatten process uses the structure information recorded above.
      return self._inputs_structure_recorder.unflatten_features_and_labels(
          values)

    return (enqueue_ops, dequeue_fn, all_hooks, run_infeed_loop_on_coordinator)
def generate_infeed_enqueue_ops_and_dequeue_fn ( self ) : # While tf.while_loop is called, the body function, which invokes # `enqueue_fn` passed in, is called to construct the graph. So, input_fn # structure is recorded. enqueue_ops , all_hooks , run_infeed_loop_on_coordinator = ( self . _invoke_input_fn_and_record_structure ( ) ) self . _validate_input_pipeline ( ) def dequeue_fn ( ) : """dequeue_fn is used by TPU to retrieve the tensors.""" # In the model-parallel case, both the host-side and device-side # computations must agree on the core on which infeed takes place. We # choose to perform infeed on logical core 0 of each replica. values = self . _infeed_queue . generate_dequeue_op ( tpu_device = 0 ) # The unflatten process uses the structure information recorded above. return self . _inputs_structure_recorder . unflatten_features_and_labels ( values ) return ( enqueue_ops , dequeue_fn , all_hooks , run_infeed_loop_on_coordinator )