chainer.functions.
transpose
(x, axes=None)[source]¶
入力値の次元をコピーせずに交換する。
Parameters: |
|
---|---|
Returns: |
軸の交換がなされたVariable |
Return type: |
Example
>>> x = np.array([[[0, 1, 2], [3, 4, 5]]], 'f')
>>> x.shape
(1, 2, 3)
>>> y = F.transpose(x) # reverse the dimensions
>>> y.shape
(3, 2, 1)
>>> y.data
array([[[ 0.],
[ 3.]],
[[ 1.],
[ 4.]],
[[ 2.],
[ 5.]]], dtype=float32)
>>> y = F.transpose(x, axes=(1, 0, 2)) # swap 1st and 2nd axis
>>> y.shape
(2, 1, 3)
>>> y.data
array([[[ 0., 1., 2.]],
[[ 3., 4., 5.]]], dtype=float32)