Concatenation (Concatenate)#
API#
- class warp_nn.modules.operators.Concatenate(dim: int = 0, *, requires_grad: bool = True)[source]#
Bases:
ModuleConcatenation (Concatenate) operation.
This class concatenates arrays along an existing dimension
dim:\[\text{Concatenate}(x_1, \ldots, x_n) = \left[ x_1, \ldots, x_n \right]_{\text{dim}}\]Each input array is copied into its slice of the output array by a kernel launch, so the gradients of the output array are propagated to the (floating-point) input arrays. Integer arrays are not differentiable.
- Parameters:
dim – The dimension along which the arrays are concatenated. Negative values count from the last dimension.
requires_grad – Whether the cached (floating-point) output arrays of the module require gradients.
- __call__(
- *inputs: array,
Forward pass of the operation.
- Parameters:
inputs – The input arrays, with up to 3 dimensions (floating-point or integer). They must have the same number of dimensions and data type, and the same shape except in the dimension
dim.- Returns:
The output array, with the shape of the input arrays except in the dimension
dim, whose size is the sum of the input arrays’ sizes in that dimension.- Raises:
ValueError – If no input arrays are given, if
dimis out of range, or if the input arrays’ shapes differ outside the dimensiondim.TypeError – If the input arrays’ data types differ, or if their data type or number of dimensions is not supported.