Concatenate a sequence of tensors along an existing axis.
All inputs must share dtype, device, and rank; every dimension except
axis must agree exactly. The output reuses freshly allocated storage —
no input buffer is aliased — and the autograd node saves only per-input
shapes so backward can split the gradient back into one slice per input.
Math
where is the unique input index satisfying .
Shape
Inputs of shape (D_0, ..., D_{axis-1}, N_i, D_{axis+1}, ..., D_{ndim-1})
produce output of shape
(D_0, ..., D_{axis-1}, \sum_i N_i, D_{axis+1}, ..., D_{ndim-1}).
See Also
stack_op, split_op, hstack_op, vstack_op.
Parameters
xsvector<TensorImplPtr>axis must be identical across inputs.axisintaxis + ndim). Must satisfy -ndim <= axis < ndim.Returns
TensorImplPtrOutput tensor of shape (..., \sum_i N_i, ...) where the axis dimension is the sum of each input's axis dimension.
Raises
DtypeMismatchDeviceMismatchShapeMismatchNotes
Backward slices the incoming gradient back into per-input pieces using the
saved size of each input along axis; the schema is
"concatenate" with AmpPolicy::KeepInput.