concat

dragon.concat(
  inputs,
  axis=0,
  **kwargs
)[source]

Concatenate the inputs along the given axis.

All dimensions except the axis should be same:

x1 = dragon.ones(shape=(2, 3))
x2 = dragon.zeros(shape=(2, 4))
y = dragon.concat([x1, x2], axis=1)  # Ok
z = dragon.concat([x1, x2], axis=0)  # Wrong

The axis can be negative representing the last-k axis:

y = dragon.concat([x1, x2], axis=1)
z = dragon.concat([x1, x2], axis=-1)  # z == y
Parameters:
  • inputs (Sequence[dragon.Tensor]) – The input tensors.
  • axis (int, optional, default=0) – The axis to concatenate.
Returns:

dragon.Tensor – The output tensor.