numojo.core.indexing.validation¶
Validation (numojo.core.indexing.validation)
Contains utilities for validating indices, shapes, and axes for various indexing and reduction operations.
Structs¶
Validator¶
Memory convention: memory_only
Implements: AnyType, ImplicitlyDestructible
Aliases¶
__del__is_trivial¶
Value: True
Methods¶
normalize¶
static
Normalize a possibly negative index.
Args:
index(Int): The index to normalize.dim(Int): The size of the dimension.
Returns:
Int
check_bounds¶
static
Check if an index is within bounds for a dimension.
Args:
index(Int): The index to check.dim(Int): The size of the dimension.axis(Int): The axis index (for error reporting).
Raises
Error: If the index is out of bounds.
validate_reshape¶
static
Validate if a reshape operation is valid.
Args:
current_size(Int): Current total number of elements.new_shape(NDArrayShape): The target shape.
Raises
Error: If the reshape is invalid.
validate_and_normalize_axes¶
static
Validate and normalize axes for reduction operations.
Args:
rank(Int): The rank of the array.axes(List): The input axes.
Returns:
List
Raises
Error: If any axis is invalid or duplicated.