chainer.functions.concat

chainer.functions.concat(xs, axis=1)[source]

Concatenates given variables along an axis.

Parameters
  • xs (tuple of Variable or N-dimensional array) – Input variables to be concatenated. The variables must have the same shape, except in the dimension corresponding to axis.

  • axis (int) – The axis along which the arrays will be joined. Default is 1.

Returns

The concatenated variable.

Return type

Variable

Example

>>> x = np.arange(0, 12).reshape(3, 4)
>>> x
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11]])
>>> y = np.arange(0, 3).reshape(3, 1)
>>> y
array([[0],
       [1],
       [2]])
>>> z = F.concat((x, y), axis=1)
>>> z.array
array([[ 0,  1,  2,  3,  0],
       [ 4,  5,  6,  7,  1],
       [ 8,  9, 10, 11,  2]])