chainer.functions.split_axis¶
-
chainer.functions.split_axis(x, indices_or_sections, axis, force_tuple=True)[source]¶ Splits given variables along an axis.
Parameters: - x (
Variableornumpy.ndarrayorcupy.ndarray) – A variable to be split. - indices_or_sections (int or 1-D array) – If this argument is an integer, N, the array will be divided into N equal arrays along axis. If it is a 1-D array of sorted integers, it indicates the positions where the array is split.
- axis (int) – Axis that the input array is split along.
- force_tuple (bool) – If
True(the default) this method returns a tuple even when the number of outputs is one. Otherwise, ifFalsea Variable will be returned when the number of outputs is one.
Returns: Tuple of
Variableobjects if the number of outputs is more than 1 orVariableotherwise. Whenforce_tupleisTrue, returned value is always a tuple regardless of the number of outputs.Return type: Note
This function raises
ValueErrorif at least one of the outputs is split to zero-size (i.e.axis-th value of its shape is zero).- x (