Python wrappers
Public Python APIs implemented by this engine symbol.Enumerate every combination across a list of 1-D tensors.
Composite over meshgrid_op (with ij indexing) +
reshape_op + stack_op. Builds the n-D grid, flattens
each component, and stacks the flattened columns along a new trailing
axis to produce a (N, D) matrix whose rows enumerate the full
Cartesian product in row-major (ij) order. Gradient flows through
MeshgridBackward, ReshapeBackward, and StackBackward.
Math
For input tensors of lengths , the output rows are
in row-major (lex) order with varying slowest.
See Also
meshgrid_op, stack_op.
Parameters
tensorsvector<TensorImplPtr>Non-empty list of 1-D tensors. Lengths may differ.
Returns
TensorImplPtrTensor of shape (N, D) where N = prod(lengths) and D is the number of inputs. Dtype matches the inputs (must agree).
Raises
FailureIf the input list is empty, any element is null, or any element is not 1-D.
Examples
cartesian_prod_op({[1, 2], [10, 20, 30]}) returns a (6, 2)
tensor: [[1, 10], [1, 20], [1, 30], [2, 10], [2, 20], [2, 30]].