combinations(input: Tensor, r: int = 2, with_replacement: bool = False)All r-length combinations of the elements of a 1-D input.
Composite over Python itertools — non-differentiable (treats
the values as opaque scalars). Use only for low-rate utility code;
don't put on a hot path.
Parameters
inputTensor1-D source tensor of length . Raises on higher rank.
rint= 2Combination length. Default
2.with_replacementbool= FalseWhen
True the output enumerates multisets (an element can
appear multiple times in a single row), giving
rows. Default False (strict
combinations, rows).Returns
TensorShape (C, r) where is the combination count.
Dtype and device follow input.