ag_slice_rows: Slice a range of rows

View source: R/autograd.R

ag_slice_rowsR Documentation

Slice a range of rows

Description

Returns rows from + 1 to from + n of x (from is 0-based), e.g. one field of a packed batch read with ag_get_rows. On the GPU it is a view made contiguous on the device, with nothing crossing the bus; inside ag_capture() from and n are constants of the recording.

Usage

ag_slice_rows(x, from, n)

Arguments

x

ag_tensor (or matrix) with at least from + n rows

from

0-based index of the first row

n

Number of rows

Details

The gradient is g in the sliced rows and zero elsewhere.

Value

ag_tensor of shape n x ncol(x)

Examples

x <- ag_tensor(matrix(1:12, 4, 3))
as.matrix(ag_slice_rows(x, 1, 2))

ggmlR documentation built on Oct. 23, 2026, 1:07 a.m.