'Creates ops for converting the input to either format.
If \'tensor\' is used, then a conversion from [stride * steps, dim] to
[steps + 1, stride, dim] is performed for dynamic_tensor reads.
If \'array\' is used, then a conversion from [steps + 1, stride, dim] to
[stride * steps, dim] is performed for bulk_tensor reads.
Args:
tensor: Bulk tensor input.
array: TensorArray dynamic input.
stride: stride of bulk tensor. Not used for dynamic.
dim: dim of bulk tensor. Not used for dynamic.'

def __init__(self, tensor=None, array=None, stride=None, dim=None):

    if (tensor is not None):
        check.IsNone(array, 'Cannot    initialize    from    tensor    and    array')
        check.NotNone(stride, 'Stride    is    required    for    bulk    tensor')
        check.NotNone(dim, 'Dim    is    required    for    bulk    tensor')
        self._bulk_tensor = tensor
        with tf.name_scope('convert_to_dyn'):
            tensor = tf.reshape(tensor, [stride, (-1), dim])
            tensor = tf.transpose(tensor, perm=[1, 0, 2])
            pad = tf.zeros([1, stride, dim], dtype=tensor.dtype)
            self._array_tensor = tf.concat([pad, tensor], 0)
    if (array is not None):
        check.IsNone(tensor, 'Cannot    initialize    from    both    tensor    and    array')
        with tf.name_scope('convert_to_bulk'):
            self._bulk_tensor = convert_network_state_tensorarray(array)
        with tf.name_scope('convert_to_dyn'):
            self._array_tensor = array.stack()
