slc: Creates a slice

View source: R/indexing.R

slcR Documentation

Creates a slice

Description

Creates a slice object that can be used when indexing torch tensors.

Usage

slc(start, end, step = 1)

Arguments

start

(integer) starting index.

end

(integer) the last selected index.

step

(integer) the step between indexes.

Examples

if (torch_is_installed()) {
x <- torch_randn(10)
x[slc(start = 1, end = 5, step = 2)]

}

torch documentation built on May 29, 2024, 9:54 a.m.