Comprehensive utilities library for JAX testing, debugging, and instrumentation
73
A utility for validating JAX array shapes and dimensions in machine learning pipelines.
@generates
"""Array shape validation utilities for JAX arrays."""
def validate_shape(array, expected_shape):
"""
Validates that the given array matches the expected shape.
Args:
array: A JAX array to validate
expected_shape: A tuple specifying the expected shape (e.g., (10, 20))
Raises:
AssertionError: If the array shape doesn't match expected_shape
"""
pass
def validate_rank(array, expected_rank):
"""
Validates that the given array has the expected number of dimensions.
Args:
array: A JAX array to validate
expected_rank: An integer specifying the expected number of dimensions
Raises:
AssertionError: If the array rank doesn't match expected_rank
"""
pass
def validate_equal_shapes(*arrays):
"""
Validates that all provided arrays have matching shapes.
Args:
*arrays: Variable number of JAX arrays to compare
Raises:
AssertionError: If any arrays have different shapes
"""
pass
def validate_flexible_shape(array, pattern):
"""
Validates that an array matches a flexible shape pattern.
Allows None as a wildcard that matches any dimension size.
Args:
array: A JAX array to validate
pattern: A tuple with integer dimensions and None wildcards (e.g., (None, 10, 20))
Raises:
AssertionError: If the array shape doesn't match the pattern
"""
passProvides shape and array assertion utilities for JAX.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-chexevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10