chainer.functions.squeeze

chainer.functions.squeeze(x, axis=None)[source]

Remove demensions of size one from the shape of a ndarray.

Parameters:
  • x (chainer.Variable or :class:numpy.ndarray or cupy.ndarray) – Input data.
  • axis (None or int or tuple of ints) – A subset of the single-dimensional entries in the shape to remove. If None is supplied, all of them are removed. The dimension index starts at zero. If an axis with dimension greater than one is selected, an error is raised.
Returns:

Variable whose dimensions of size 1 are removed.

Return type:

Variable