| ag_get_rows | R Documentation |
Selects columns of an ag_buffer by 0-based index, as a device
operation: on the GPU only the indices cross the bus. The name follows
ggml_get_rows, which selects along the second ggml dimension (ne1);
in the R rows x capacity view that is a column.
ag_get_rows(buf, idx)
buf |
An |
idx |
0-based column indices: a numeric vector, or an ag_tensor with
one column (f32; indices are exact below |
The result is a rows x length(idx) ag_tensor without gradient, usable
as an input to further ag_* operations. Inside ag_capture()
pass idx as an argument of the captured function: the recording is
then reused for every index vector of the same length (the batch size is
part of the recording's shape), and the buffer must be listed in
params so that freeing it invalidates the recording.
Indices given as host values are checked against the buffer and an
index out of range is an error. An index tensor already on the device
(inside a recording) cannot be checked; on the device every index is
clamped to 0..capacity-1 before the read, so an index out of range
reads the first or last column instead of memory outside the buffer.
An ag_tensor of shape rows x length(idx).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.