def transpose(a, perm=None, name=None): r"""Permute the dimensions of input. Examples: ```python # Provide the permutation for all axes x = tf.ones(shape=(2, 3, 4)) print(tf.transpose(x, (0, 2, 1)).shape) # (2, 4, 3) # Or dimensions will be simply inverse print(tf.transpose(x).shape) # (4, 3, 2) ``` Parameters ---------- a : dragon.Tensor The input tensor. perm : Sequence[Union[int, dragon.Tensor]] The output permutation. name : str, optional The operation name. Returns ------- dragon.Tensor The output tensor. """ return array_ops.transpose(a, perm=perm, name=name)
def transpose(self, perm=None, copy=True): """Return a tensor with permuted axes. Parameters ---------- perm : Union[Sequence[int], dragon.Tensor]], optional The output permutation. copy : bool, optional, default=True Return a new tensor or transpose in-place. Returns ------- dragon.Tensor The output tensor. See Also -------- `dragon.transpose(...)`_ """ return array_ops.transpose(self, perm=perm, copy=copy)
def forward(self, inputs, **kwargs): return array_ops.transpose(inputs, perm=self.perm)
def call(self, inputs): return array_ops.transpose(inputs, perm=[0] + self.dims)
def __call__(self, bottom): return array_ops.transpose(bottom, **self.arguments)
def call(self, inputs): if self.data_format == 'channels_first': perm = [0] + [i for i in range(2, len(inputs.shape))] + [1] inputs = array_ops.transpose(inputs, perm=perm) return array_ops.flatten(inputs, keep_axes=2)
def __call__(self, bottom): return array_ops.transpose(bottom, **self.call_args)