Skip to main content

ClikaRT::ops::split_with_sizes

function

split_with_sizes()

std::vector<Tensor> split_with_sizes(
    Tensor x,
    ClikaRT::Span<const ScalarOrTensor> sizes,
    int64_t dim = 0
)

Split along dim into chunks of the given lengths; sizes must sum to the dim's extent. Each length is a literal or a 0-D integer Tensor.

Returns VIEWS; every chunk shares the source's storage (no copy).

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when the sizes do not sum to the dim's extent (code_name() carries the reason).

Returns: one view per requested chunk.

auto qkv = ClikaRT::ops::split_with_sizes(fused, {dq, dk, dv}, -1);

Declared in ClikaRT/compute/ops.h, line 3369