Beispiel #1
0
def transpose(a, perm=None, name=None):
    """
    Transposes `a`. Permutes the dimensions according to `perm`.

      The returned tensor's dimension i will correspond to the input dimension
      `perm[i]`. If `perm` is not given, it is set to (n-1...0), where n is
      the rank of the input tensor. Hence by default, this operation performs a
      regular matrix transpose on 2-D input Tensors.

      For example:

      ```python
      # 'x' is [[1 2 3]
      #         [4 5 6]]
      tf.transpose(x) ==> [[1 4]
                           [2 5]
                           [3 6]]

      # Equivalently
      tf.transpose(x, perm=[1, 0]) ==> [[1 4]
                                        [2 5]
                                        [3 6]]

      # 'perm' is more useful for n-dimensional tensors, for n > 2
      # 'x' is   [[[1  2  3]
      #            [4  5  6]]
      #           [[7  8  9]
      #            [10 11 12]]]
      # Take the transpose of the matrices in dimension-0
      tf.transpose(x, perm=[0, 2, 1]) ==> [[[1  4]
                                            [2  5]
                                            [3  6]]

                                           [[7 10]
                                            [8 11]
                                            [9 12]]]
      ```

      Args:
        a: A `Tensor`.
        perm: A permutation of the dimensions of `a`.
        name: A name for the operation (optional).

      Returns:
        A transposed `Tensor`.

      """

    return ops.Transpose(a, perm=perm, name=name)
Beispiel #2
0
def transpose(x, axes=None):
    """Transpose the input according to the given permutations.

    Parameters
    ----------
    x : Tensor
        The input tensor.
    axes : tuple, list or None
        The permutations. Default is ``None`` (Reverse Dimensions).

    Returns
    -------
    Tensor
        The output tensor.

    """
    return ops.Transpose(x, perms=axes)
Beispiel #3
0
def transpose(x, axes=None):
    """Transpose the input according to the given permutations.

    Parameters
    ----------
    x : Tensor
        The input tensor.
    axes : sequence of int, optional
        The permutations. Default is ``None`` (Reverse Dimensions).

    Returns
    -------
    Tensor
        The output tensor.

    """
    return _ops.Transpose(x, perm=axes)
Beispiel #4
0
def transpose(a, perm=None, name=None):

    return ops.Transpose(a, perm=perm, name=name)
Beispiel #5
0
 def LayerSetup(self, bottom):
     return _ops.Transpose(bottom, **self.arguments)
Beispiel #6
0
 def Setup(self, bottom):
     super(PermuteLayer, self).Setup(bottom)
     input = bottom[0] if isinstance(bottom, list) else bottom
     return ops.Transpose(input, **self._param)