chainer.functions.separate(x, axis=0)[source]

Separates an array along a given axis.与えられた軸に添って配列を分割するl

 

この関数は与えられた軸に添って配列を分割します。例えばshape (2, 3, 4)である配列。 axis=1にもとづいて配列を分割した場合、2つの (2, 4) 配列を返します。

 

この関数は chainer.functions.stack()の反転です。

 

Parameters:
Returns:  出力値。
Return type:

chainer.Variableのタプル

See also

chainer.functions.stack()

 

Example

 



>>> x = np.arange(6).reshape((2, 3)).astype('f')

>>> x array([[ 0., 1., 2.], [ 3., 4., 5.]], dtype=float32)
>>> x.shape (2, 3)
>>> y = F.separate(x) # split along axis=0
>>> type(y) <class 'tuple'>
>>> len(y) 2
>>> y[0].shape (3,)
>>> y[0].data
array([ 0., 1., 2.], dtype=float32)
>>> y = F.separate(x, axis=1)
>>> len(y) 3
>>> y[0].shape (2,)
>>> y[0].data
array([ 0., 3.], dtype=float32)