Trait burn::tensor::RangesArg

pub trait RangesArg<const D2: usize> {
    // Required method
    fn into_ranges(self, shape: Shape) -> [Range<usize>; D2];

    // Provided methods
    fn handle_negative_index(start: i64, end: i64, dim: usize) -> (usize, usize) { ... }
    fn clamp_range(start: usize, end: usize, dim: usize) -> (usize, usize) { ... }
}
Expand description

Trait used for slice arguments

Required Methods§

fn into_ranges(self, shape: Shape) -> [Range<usize>; D2]

Converts into a set of ranges to [core::ops::Range<usize>; D2] for the tensor.slice() function

Provided Methods§

fn handle_negative_index(start: i64, end: i64, dim: usize) -> (usize, usize)

Handles negative index values

fn clamp_range(start: usize, end: usize, dim: usize) -> (usize, usize)

Clamps the range to the shape dimensions

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl<const D2: usize> RangesArg<D2> for [(i64, i64); D2]

§

fn into_ranges(self, shape: Shape) -> [Range<usize>; D2]

§

impl<const D2: usize> RangesArg<D2> for [Option<(i64, i64)>; D2]

§

fn into_ranges(self, shape: Shape) -> [Range<usize>; D2]

§

impl<const D2: usize> RangesArg<D2> for [Range<usize>; D2]

§

fn into_ranges(self, shape: Shape) -> [Range<usize>; D2]

Implementors§