Skip to main content

ClikaRT::ops::chunk

function

chunk()

std::vector<Tensor> chunk(
    Tensor x,
    int64_t num_chunks,
    int64_t dim = 0
)

Split along dim into num_chunks near-equal parts (the last may be shorter). Returns VIEWS sharing the source's storage (one call, no copy); prefer it over repeated narrows.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when num_chunks is not positive (code_name() carries the reason).

Returns: num_chunks views of the source.

auto pair = ClikaRT::ops::chunk(gate_up, 2, -1); // gate‖up split, no copy

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