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 (Variable or N-dimensional array) – 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, if False a Variable will be returned when the number of outputs is one.

Returns

Tuple of Variable objects if the number of outputs is more than 1 or Variable otherwise. When force_tuple is True, returned value is always a tuple regardless of the number of outputs.

Return type

tuple or Variable