fn
einops_repeat_op
→TensorImplPtrint einops_repeat_op(const int & a, const int & pattern, const int & axes_lengths)Tile / broadcast a tensor to introduce new axes specified by an einops pattern.
Axes present in rhs but absent from lhs are new and their sizes
must be provided in axes_lengths. Existing axes may additionally be
reordered and merged exactly as in einops_rearrange_op. Internally
the op uses unsqueeze + broadcast_to so it avoids data copies
whenever possible — repeat is materialised only when subsequent ops force
a contiguous layout.
Math
For each new axis of size :
See Also
einops_rearrange_op, einops_reduce_op, einsum_op
Parameters
aTensorImplPtrInput tensor.
patternstd::stringEinops pattern
"lhs -> rhs" with at least one axis introduced on the rhs.axes_lengthsstd::map<std::string, std::int64_t>Sizes for the new axes introduced on the
rhs. Must contain every axis name that does not appear on the lhs.Returns
TensorImplPtrTensor with new axes broadcast/repeated to the requested sizes.
Raises
EinopsPatternErrorIf a new axis on the
rhs is missing from axes_lengths.