Function canonicalize_index
pub fn canonicalize_index<Index>(
idx: Index,
size: usize,
wrap_scalar: bool,
) -> usizewhere
Index: AsIndex,Expand description
Canonicalizes and bounds checks an index with negative indexing support.
§Arguments
idx- The index to canonicalize.size- The size of the index range.wrap_scalar- If true, pretend scalars have rank=1.
§Returns
The canonicalized dimension index.
§Panics
- If
wrap_scalaris false and the tensor has no dimensions. - If the dimension index is out of range.