sliceAt

fun <T : DType, V> Tensor<T, V>.sliceAt(vararg indices: Int): TensorView<T, V>(source)

Convenience method for extracting specific indices across dimensions.

This method enables quick extraction of specific slices by providing individual indices for each dimension, which is useful for accessing specific samples, channels, or spatial locations.

Usage Example

// Extract specific batch=0, channel=3 from NCHW tensor (reduces to HW)
val view = tensor.sliceAt(0, 3) // Results in 2D tensor

Return

a TensorView with reduced dimensionality

Parameters

indices

the specific indices to select for each dimension

Throws

if index count doesn't match tensor rank