()
return _unbatch
Returns a function which unbatches.
Returns a function which unbatches.
Returns a function which unbatches .
def UnBatch():  # pylint: disable=invalid-name
  """Returns a function which unbatches."""
  def _unbatch(generator):
    for batched_example in generator:
      # batched_example is usually like:
      # (batched_inputs, batched_outputs) or
      # (batched_inputs, batched_outputs, batched_weights)
      assert isinstance(batched_example, tuple)
      # assert all lengths are the same.
      batch_sizes = list(set(map(lambda example: example.shape[0],
                                 batched_example)))
      assert len(batch_sizes) == 1
      # Now unbatch examples.
      for example_idx in range(batch_sizes[0]):
        yield tuple(map(lambda x: x[example_idx], batched_example))  # pylint: disable=cell-var-from-loop
  return _unbatch
def UnBatch ( ) : # pylint: disable=invalid-name def _unbatch ( generator ) : for batched_example in generator : # batched_example is usually like: # (batched_inputs, batched_outputs) or # (batched_inputs, batched_outputs, batched_weights) assert isinstance ( batched_example , tuple ) # assert all lengths are the same. batch_sizes = list ( set ( map ( lambda example : example . shape [ 0 ] , batched_example ) ) ) assert len ( batch_sizes ) == 1 # Now unbatch examples. for example_idx in range ( batch_sizes [ 0 ] ) : yield tuple ( map ( lambda x : x [ example_idx ] , batched_example ) ) # pylint: disable=cell-var-from-loop return _unbatch