chainer.functions.
expand_dims
(x, axis)[source]¶
入力値の次元ををコピーせずに拡張する。
Parameters: |
|
---|---|
Returns: |
Variable that holds a expanded input. The |
Return type: |
Example
>>> x = np.array([1, 2, 3])
>>> x.shape
(3,)
>>> y = F.expand_dims(x, axis=0)
>>> y.shape
(1, 3)
>>> y.data
array([[1, 2, 3]])
>>> y = F.expand_dims(x, axis=1)
>>> y.shape
(3, 1)
>>> y.data
array([[1],
[2],
[3]])
>>> y = F.expand_dims(x, axis=-2)
>>> y.shape
(1, 3)
>>> y.data
array([[1, 2, 3]])