code: def reshape_data(tensor, per_example_length=1):
    
    # We can put the data into a format that can be easily cleaved by
    # transposing it (so that it varies fastest in batch) and then making each
    # component have a single value.
    # This will make it compatible with the Pretty Tensor function
    # cleave_sequence.
    dims = [1, 0]
    for i in xrange(2, tensor.get_shape().ndims):
      dims.append(i)
    return pt.wrap(tf.transpose(tensor, dims)).reshape([-1, per_example_length])
docs: Reshapes input so that it is appropriate for sequence_lstm..
  
    The expected format for sequence lstms is
    [timesteps * batch, per_example_length] and the data produced by the utilities
    is [batch, timestep, *optional* expected_length].  The result can be cleaved
    so that there is a Tensor per timestep.
  
    Args:
      tensor: The tensor to reshape.
      per_example_length: The number of examples at each timestep.
    Returns:
      A Pretty Tensor that is compatible with cleave and then sequence_lstm.