Expand description
Implementation of Array Protocol (similar to NumPy
’s __array_function__
protocol)
This module provides a mechanism for third-party array implementations to
override SciRS2
functions. It is inspired by NumPy
’s __array_function__
protocol defined in NEP-18.
The protocol enables third-party arrays to implement SciRS2
functions in a way
that is recognized by the SciRS2
library. This allows for seamless integration with
distributed arrays, GPU arrays, and other custom array implementations.
§Core Components
The Array Protocol system includes:
- Specialized array implementations (GPU, distributed, JIT)
- Automatic device placement with
AutoDevice
- Mixed-precision operations
- Neural network layers and models
- Gradient computation and training capabilities
- Distributed training and model serialization
Re-exports§
pub use self::ml_ops::activation;
pub use self::ml_ops::batch_norm;
pub use self::ml_ops::conv2d;
pub use self::ml_ops::cross_entropy;
pub use self::ml_ops::dropout;
pub use self::ml_ops::max_pool2d;
pub use self::ml_ops::self_attention;
pub use self::ml_ops::ActivationFunc;
Modules§
- auto_
device - Automatic device placement for array operations.
- distributed_
training - Distributed training support for the array protocol.
- gpu_
kernels - A collection of GPU kernels for common operations
- grad
- Gradient computation support for the array protocol.
- mixed_
precision - Mixed-precision operations for the array protocol.
- ml_ops
- Machine learning operations using the array protocol.
- neural
- Neural network layers and models using the array protocol.
- serialization
- Serialization and deserialization of neural network models.
- training
- Training utilities for neural networks using the array protocol.
- traits
- Extra traits for third-party array implementations.
Macros§
Structs§
- Array
Chunk - A chunk of a distributed array
- Array
Function - A wrapper for functions that can be overridden by the array protocol.
- Array
Function Decorator - Decorator for adding array function dispatch capabilities to a function.
- Array
Function Registry - Registry of all array functions with dispatch caching.
- Array
Protocol Function - A factory for creating and registering array protocol enabled functions.
- Cranelift
Function Factory - A factory for creating JIT functions using the Cranelift backend
- Dispatch
Cache Entry - Cache entry for function dispatch optimization
- Distributed
Config - A configuration for distributed array operations
- Distributed
Ndarray - A distributed array implementation
- GPUArray
Builder - A builder for GPU arrays
- GPUConfig
- Configuration for GPU operations
- GPUNdarray
- A mock implementation of a GPU array
- JITConfig
- Configuration for JIT compilation
- JITEnabled
Array - An array that supports JIT compilation
- JITFactory
Registry - Registry of JIT function factories.
- JITFunction
Impl - A compiled JIT function
- JITManager
- A JIT manager that selects the appropriate factory for a given array type
- LLVM
Function Factory - A factory for creating JIT functions using the LLVM backend
- Mock
Distributed Array - A mock distributed array implementation.
- MockGPU
Array - A mock GPU array implementation.
- Ndarray
Wrapper - A wrapper for ndarray to implement the ArrayProtocol trait.
- NotImplemented
- Marker for functions not implemented by a specific type.
Enums§
- Distributed
Backend - Communication backends for distributed arrays
- Distribution
Strategy - Strategies for distributing an array
- GPUBackend
- GPU backends that can be used
- JITBackend
- JIT compilation backends
- Operation
Error - Error type for array operations.
Traits§
- Array
Protocol - Trait for objects that can handle the array protocol.
- Distributed
Array - Trait for distributed arrays that can span multiple machines.
- GPUArray
- Trait for arrays that can support GPU operations.
- JITArray
- JIT (Just-In-Time) compilation support for arrays.
- JITFunction
- A JIT-compiled function that can be evaluated on arrays.
- JITFunction
Factory - A factory for creating JIT functions for specific array implementations.
Functions§
- add
- apply_
elementwise - array_
function_ dispatch - Calls the array protocol with the given function and arguments.
- concatenate
- get_
implementing_ args - Helper function to extract all arguments implementing the
ArrayProtocol
trait. - init
- Initializes the array protocol system.
- inverse
- matmul
- multiply
- reshape
- subtract
- sum
- svd
- transpose
Type Aliases§
- Array
Function Impl - Type alias for the complex function implementation type