megengine.functional.concat

concat(inps, axis=0, device=None)[source]

Concat some tensors

Parameters
  • inps (Iterable[Tensor]) – input tensors to concat.

  • axis (int) – over which dimension the tensors are concatenated. Default: 0

  • device – which device output will be. Default: None

Return type

Tensor

Returns

output tensor.

Examples

>>> import numpy as np
>>> data1 = Tensor(np.arange(0, 6, dtype=np.float32).reshape((2, 3)))
>>> data2 = Tensor(np.arange(6, 12, dtype=np.float32).reshape((2, 3)))
>>> out = F.concat([data1, data2])
>>> out.numpy()
array([[ 0.,  1.,  2.],
       [ 3.,  4.,  5.],
       [ 6.,  7.,  8.],
       [ 9., 10., 11.]], dtype=float32)