Thanks to visit codestin.com
Credit goes to docs.rs

Crate torsh_core

Crate torsh_core 

Source
Expand description

Core types and traits for the ToRSh deep learning framework

This crate provides fundamental building blocks used throughout ToRSh, including error types, device abstractions, and core traits.

Re-exports§

pub use alloc_optimizer::acquire_shape_buffer;
pub use alloc_optimizer::get_allocation_stats;
pub use alloc_optimizer::release_shape_buffer;
pub use alloc_optimizer::reset_allocation_stats;
pub use alloc_optimizer::track_allocation;
pub use alloc_optimizer::BufferPool;
pub use alloc_optimizer::ScopedBuffer;
pub use alloc_optimizer::AllocationStats;
pub use alloc_optimizer::CowShape;
pub use alloc_optimizer::OptimizationRecommendations;
pub use alloc_optimizer::StackShape;
pub use alloc_optimizer::MAX_STACK_DIMS;
pub use api_compat::clear_deprecation_counts;
pub use api_compat::configure_deprecation_warnings;
pub use api_compat::deprecation_warning;
pub use api_compat::deprecation_warning_inline;
pub use api_compat::get_all_deprecations;
pub use api_compat::get_deprecation_info;
pub use api_compat::get_deprecation_stats;
pub use api_compat::register_deprecation;
pub use api_compat::DeprecationInfo;
pub use api_compat::DeprecationReport;
pub use api_compat::DeprecationSeverity;
pub use api_compat::Version;
pub use api_compat::TORSH_VERSION;
pub use backend_detection::BackendFeatureDetector;
pub use backend_detection::BackendSummary;
pub use backend_detection::DeviceInfo;
pub use backend_detection::PerformanceTier;
pub use backend_detection::RuntimeFeatures;
pub use backend_detection::WorkloadType;
pub use cache_oblivious::CacheObliviousAnalyzer;
pub use cache_oblivious::CacheObliviousLayout;
pub use cache_oblivious::CacheObliviousMatMul;
pub use cache_oblivious::CacheObliviousReshape;
pub use cache_oblivious::CacheObliviousTranspose;
pub use chunking::ChunkingRecommendation;
pub use chunking::ChunkingStrategy;
pub use chunking::ChunkingUtils;
pub use chunking::TensorChunkConfig;
pub use compression::BitmapEncoded;
pub use compression::CompressionAnalysis;
pub use compression::CompressionEncoding;
pub use compression::CompressionSelector;
pub use compression::DeltaEncoded;
pub use compression::MagnitudeThresholdCalculator;
pub use compression::PruningMetadata;
pub use compression::PruningStrategy;
pub use compression::RunLengthEncoded;
pub use debug_validation::validate_allocation_size;
pub use debug_validation::validate_broadcast_compatible;
pub use debug_validation::validate_dtype_compatibility;
pub use debug_validation::validate_dtype_supports_operation;
pub use debug_validation::validate_index_bounds;
pub use debug_validation::validate_shape_consistency;
pub use debug_validation::validate_shape_valid;
pub use debug_validation::validate_strides;
pub use device::AllToAllTopology;
pub use device::CrossDeviceOp;
pub use device::Device;
pub use device::DeviceCapabilities;
pub use device::DeviceGroup;
pub use device::DeviceHandle;
pub use device::DeviceTopology;
pub use device::DeviceType;
pub use device::PeerToPeerOps;
pub use device::PhantomCpu;
pub use device::PhantomCuda;
pub use device::PhantomDevice;
pub use device::PhantomMetal;
pub use device::PhantomWgpu;
pub use device::RingTopology;
pub use device::TransferCompatible;
pub use device::TreeTopology;
pub use device::TypedDeviceAffinity;
pub use distributed::CheckpointMetadata;
pub use distributed::CollectiveOp as DistributedCollectiveOp;
pub use distributed::CommBackend;
pub use distributed::CommunicationDescriptor;
pub use distributed::DeviceGroup as DistributedDeviceGroup;
pub use distributed::DeviceId as DistributedDeviceId;
pub use distributed::DeviceTopology as DistributedDeviceTopology;
pub use distributed::DistributedTensor;
pub use distributed::ReduceOp as DistributedReduceOp;
pub use distributed::Shard;
pub use distributed::ShardingStrategy;
pub use dtype::AutoPromote;
pub use dtype::Complex32;
pub use dtype::Complex64;
pub use dtype::ComplexElement;
pub use dtype::DType;
pub use dtype::FloatElement;
pub use dtype::QInt8;
pub use dtype::QUInt8;
pub use dtype::TensorElement;
pub use dtype::TypePromotion;
pub use error::ErrorLocation;
pub use error::Result;
pub use error::TorshError;
pub use error_codes::ErrorCategory;
pub use error_codes::ErrorCodeMapper;
pub use error_codes::ErrorDetails;
pub use error_codes::StandardErrorCode;
pub use federated::AggregationStrategy;
pub use federated::ClientId;
pub use federated::ClientSelectionStrategy;
pub use federated::ClientSelector;
pub use federated::ClientUpdate;
pub use federated::CompressionTechnique;
pub use federated::CoordinatorStatistics;
pub use federated::DataDistribution;
pub use federated::FairnessMetrics;
pub use federated::FederatedClient;
pub use federated::FederatedCoordinator;
pub use federated::PrivacyParameters;
pub use federated::TrainingRound;
pub use ffi::TorshDType;
pub use ffi::TorshDevice;
pub use ffi::TorshErrorCode;
pub use ffi::TorshShape;
pub use gpu_shape_ops::GpuShapeAccelerator;
pub use gpu_shape_ops::AcceleratorConfig;
pub use gpu_shape_ops::AcceleratorStats;
pub use hdf5_metadata::BloscCompressor;
pub use hdf5_metadata::BloscShuffle;
pub use hdf5_metadata::Hdf5AttributeValue;
pub use hdf5_metadata::Hdf5ByteOrder;
pub use hdf5_metadata::Hdf5Chunking;
pub use hdf5_metadata::Hdf5DatasetMetadata;
pub use hdf5_metadata::Hdf5Datatype;
pub use hdf5_metadata::Hdf5DimensionScale;
pub use hdf5_metadata::Hdf5FileMetadata;
pub use hdf5_metadata::Hdf5Filter;
pub use hdf5_metadata::Hdf5GroupMetadata;
pub use hdf5_metadata::Hdf5TypeClass;
pub use health::health_checker;
pub use health::init_health_checker;
pub use health::HealthChecker;
pub use health::HealthCheckConfig;
pub use health::HealthCheckResult;
pub use health::HealthReport;
pub use health::HealthStatus;
pub use ieee754_compliance::is_ieee754_compliant;
pub use ieee754_compliance::validate_ieee754_operation;
pub use ieee754_compliance::ComplianceChecker;
pub use ieee754_compliance::Exception;
pub use ieee754_compliance::IEEE754Float;
pub use ieee754_compliance::RoundingMode;
pub use ieee754_compliance::SpecialValue;
pub use interop::ArrowDataType;
pub use interop::ArrowTypeInfo;
pub use interop::ConversionUtils;
pub use interop::FromExternal;
pub use interop::FromExternalZeroCopy;
pub use interop::InteropDocs;
pub use interop::NumpyArrayInfo;
pub use interop::OnnxDataType;
pub use interop::OnnxTensorInfo;
pub use interop::ToExternal;
pub use interop::ToExternalZeroCopy;
pub use jax_transforms::CacheStats;
pub use jax_transforms::ComposedTransform;
pub use jax_transforms::GradTransform;
pub use jax_transforms::JitTransform;
pub use jax_transforms::Jittable;
pub use jax_transforms::Parallelizable;
pub use jax_transforms::PmapTransform;
pub use jax_transforms::TransformId;
pub use jax_transforms::TransformMetadata;
pub use jax_transforms::TransformRegistry;
pub use jax_transforms::TransformType;
pub use jax_transforms::Vectorizable;
pub use jax_transforms::VmapTransform;
pub use layout_optimizer::AccessPattern;
pub use layout_optimizer::AccessStatistics;
pub use layout_optimizer::AccessTracker;
pub use layout_optimizer::LayoutOptimizer;
pub use layout_optimizer::LayoutRecommendation;
pub use layout_optimizer::TransformationCost;
pub use memory_debug::detect_memory_leaks;
pub use memory_debug::generate_memory_report;
pub use memory_debug::get_memory_stats;
pub use memory_debug::init_memory_debugger;
pub use memory_debug::init_memory_debugger_with_config;
pub use memory_debug::record_allocation;
pub use memory_debug::record_deallocation;
pub use memory_debug::AllocationInfo;
pub use memory_debug::AllocationPattern;
pub use memory_debug::DebuggingAllocator;
pub use memory_debug::MemoryDebugConfig;
pub use memory_debug::MemoryDebugger;
pub use memory_debug::MemoryLeak;
pub use memory_debug::MemoryReport;
pub use memory_debug::MemoryStats;
pub use memory_debug::SystemDebuggingAllocator;
pub use memory_monitor::AllocationStrategy;
pub use memory_monitor::MemoryMonitorConfig;
pub use memory_monitor::MemoryPressure;
pub use memory_monitor::MemoryPressureThresholds;
pub use memory_monitor::SystemMemoryMonitor;
pub use memory_monitor::SystemMemoryStats;
pub use memory_visualization::AllocationSummary;
pub use memory_visualization::AllocationTimeline;
pub use memory_visualization::MemoryMap;
pub use memory_visualization::SizeHistogram;
pub use mlir_integration::MlirAttributes;
pub use mlir_integration::MlirBuilder;
pub use mlir_integration::MlirDialect;
pub use mlir_integration::MlirModule;
pub use mlir_integration::MlirOp;
pub use mlir_integration::MlirOpcode;
pub use mlir_integration::MlirPass;
pub use mlir_integration::MlirType;
pub use mlir_integration::MlirValue;
pub use neuromorphic::CoreUtilization;
pub use neuromorphic::EventDrivenSimulation;
pub use neuromorphic::IzhikevichNeuron;
pub use neuromorphic::LIFNeuron;
pub use neuromorphic::NeuromorphicCore;
pub use neuromorphic::RateDecoder;
pub use neuromorphic::RateEncoder;
pub use neuromorphic::STDPSynapse;
pub use neuromorphic::SpikeEncoding;
pub use neuromorphic::SpikeEvent;
pub use neuromorphic::SpikeTrain;
pub use op_trace::trace_operation;
pub use op_trace::trace_operation_result;
pub use op_trace::OpTracer;
pub use op_trace::OperationTrace;
pub use op_trace::TensorMetadata;
pub use op_trace::TraceBuilder;
pub use op_trace::TraceConfig;
pub use op_trace::TraceId;
pub use op_trace::TraceStatistics;
pub use perf_metrics::get_metrics_tracker;
pub use perf_metrics::init_metrics_tracker;
pub use perf_metrics::AdvancedMetricsConfig;
pub use perf_metrics::AdvancedMetricsTracker;
pub use perf_metrics::CacheEfficiencyMetrics;
pub use perf_metrics::MemoryBandwidthMetrics;
pub use perf_metrics::ParallelEfficiencyMetrics;
pub use perf_metrics::RegressionDetection;
pub use perf_metrics::SimdUtilizationMetrics;
pub use perf_regression::BenchmarkRunner;
pub use perf_regression::PerfBaseline;
pub use perf_regression::PerfComparison;
pub use perf_regression::PerfMeasurement;
pub use perf_regression::PerfStatistics;
pub use perf_regression::RegressionReport;
pub use perf_regression::RegressionSeverity;
pub use perf_regression::RegressionTracker;
pub use profiling::get_profiler;
pub use profiling::init_profiler;
pub use profiling::profile_closure;
pub use profiling::OperationContext;
pub use profiling::OperationHandle;
pub use profiling::OperationRecord;
pub use profiling::OperationStats;
pub use profiling::OperationType;
pub use profiling::PerformanceBottleneck;
pub use profiling::PerformanceProfiler;
pub use profiling::ProfilerConfig;
pub use runtime_config::ConfigPreset;
pub use runtime_config::DebugLevel;
pub use runtime_config::MemoryTrackingConfig;
pub use runtime_config::MonitoringScope;
pub use runtime_config::OperationConfig;
pub use runtime_config::RuntimeConfig;
pub use runtime_config::RuntimeConfigSnapshot;
pub use runtime_config::ValidationLevel;
pub use scirs2_bridge::SharedBufferManager;
pub use scirs2_bridge::ErrorMapper;
pub use scirs2_bridge::SciRS2Bridge;
pub use scirs2_bridge::TransferMetadata;
pub use scirs2_bridge::TransferStrategy;
pub use scirs2_bridge::ZeroCopyView;
pub use shape::Shape;
pub use shape_graph::InferenceResult;
pub use shape_graph::NodeId;
pub use shape_graph::ShapeGraph;
pub use shape_graph::ShapeInferenceError;
pub use shape_graph::ShapeNode;
pub use shape_graph::ShapeOp;
pub use shape_utils::are_compatible;
pub use shape_utils::batch_shape;
pub use shape_utils::expand_to_rank;
pub use shape_utils::flatten_from;
pub use shape_utils::image_shape;
pub use shape_utils::matrix_shape;
pub use shape_utils::numel;
pub use shape_utils::permute;
pub use shape_utils::scalar_shape;
pub use shape_utils::sequence_shape;
pub use shape_utils::squeeze;
pub use shape_utils::unsqueeze_at;
pub use shape_utils::vector_shape;
pub use simd_arm::ArmSimdOps;
pub use sparse::CompressionStats;
pub use sparse::CooIndices;
pub use sparse::CooStorage;
pub use sparse::CsrIndices;
pub use sparse::CsrStorage;
pub use sparse::SparseFormat;
pub use sparse::SparseMetadata;
pub use sparse::SparseStorage;
pub use storage::allocate_pooled;
pub use storage::clear_pooled_memory;
pub use storage::deallocate_pooled;
pub use storage::pooled_memory_stats;
pub use storage::MemoryFormat;
pub use storage::MemoryPool;
pub use storage::PoolStats;
pub use storage::SharedStorage;
pub use storage::Storage;
pub use storage::StorageView;
pub use symbolic_shape::DimExpression;
pub use symbolic_shape::ShapeInference;
pub use symbolic_shape::SymbolId;
pub use symbolic_shape::SymbolRegistry;
pub use symbolic_shape::SymbolicDim;
pub use symbolic_shape::SymbolicShape;
pub use telemetry::init_telemetry;
pub use telemetry::telemetry;
pub use telemetry::Span;
pub use telemetry::SpanEvent;
pub use telemetry::SpanMetrics;
pub use telemetry::TelemetrySystem;
pub use telemetry::ErrorCode;
pub use telemetry::LogEvent;
pub use telemetry::LogLevel;
pub use telemetry::TelemetryConfig;
pub use tensor_expr::math::AbsExpr;
pub use tensor_expr::math::MathExpr;
pub use tensor_expr::math::SqrExpr;
pub use tensor_expr::AddOp;
pub use tensor_expr::ArrayExpr;
pub use tensor_expr::BinaryExpr;
pub use tensor_expr::DivOp;
pub use tensor_expr::ExprBuilder;
pub use tensor_expr::MapExpr;
pub use tensor_expr::MulOp;
pub use tensor_expr::NegExpr;
pub use tensor_expr::ScalarExpr;
pub use tensor_expr::SubOp;
pub use tensor_expr::TensorExpr;
pub use tensor_network::EdgeId;
pub use tensor_network::IndexDim;
pub use tensor_network::MatrixProductState;
pub use tensor_network::NodeId as TensorNodeId;
pub use tensor_network::ProjectedEntangledPairState;
pub use tensor_network::TensorEdge;
pub use tensor_network::TensorNetwork;
pub use tensor_network::TensorNetworkError;
pub use tensor_network::TensorNode;
pub use type_level_ad::stop_gradient;
pub use type_level_ad::ADComputation;
pub use type_level_ad::ADMode;
pub use type_level_ad::BackwardOp;
pub use type_level_ad::BinaryOp;
pub use type_level_ad::ChainRule;
pub use type_level_ad::CheckpointedOp;
pub use type_level_ad::ComputeGradReq;
pub use type_level_ad::ComputeHessian;
pub use type_level_ad::ComputeJacobian;
pub use type_level_ad::CustomGradient;
pub use type_level_ad::ForwardMode;
pub use type_level_ad::GradOp;
pub use type_level_ad::GradState;
pub use type_level_ad::Gradient;
pub use type_level_ad::GradientAccumulator;
pub use type_level_ad::GradientClipper;
pub use type_level_ad::Hessian;
pub use type_level_ad::HigherOrderDiff;
pub use type_level_ad::Jacobian;
pub use type_level_ad::NoGrad;
pub use type_level_ad::RequiresGrad;
pub use type_level_ad::ReverseMode;
pub use type_level_ad::TypedTensor;
pub use type_level_ad::UnaryGradOp;
pub use type_level_shapes::Assert;
pub use type_level_shapes::AssertShapeEq;
pub use type_level_shapes::Batched;
pub use type_level_shapes::BroadcastCompatible;
pub use type_level_shapes::Concat;
pub use type_level_shapes::Conv2D;
pub use type_level_shapes::Dim;
pub use type_level_shapes::DimList;
pub use type_level_shapes::Flatten;
pub use type_level_shapes::ImageBatchNCHW;
pub use type_level_shapes::ImageBatchNHWC;
pub use type_level_shapes::MatMul;
pub use type_level_shapes::Matrix;
pub use type_level_shapes::Pool2D;
pub use type_level_shapes::Reshape;
pub use type_level_shapes::Reverse;
pub use type_level_shapes::Scalar;
pub use type_level_shapes::Squeeze;
pub use type_level_shapes::Tensor;
pub use type_level_shapes::Tensor3D;
pub use type_level_shapes::Tensor4D;
pub use type_level_shapes::Transpose2D;
pub use type_level_shapes::Unsqueeze;
pub use type_level_shapes::Vector;
pub use webgpu::BindGroupEntry;
pub use webgpu::BindGroupLayout;
pub use webgpu::BufferUsage;
pub use webgpu::ComputePipeline;
pub use webgpu::GPUBuffer;
pub use webgpu::PipelineCache;
pub use webgpu::ResourceType;
pub use webgpu::ShaderError;
pub use webgpu::ShaderStage;
pub use webgpu::WGSLShader;
pub use webgpu::WorkgroupOptimizer;
pub use xla_integration::AlgebraicSimplificationPass;
pub use xla_integration::CommonSubexpressionEliminationPass;
pub use xla_integration::ConstantFoldingPass;
pub use xla_integration::CopyEliminationPass;
pub use xla_integration::DeadCodeEliminationPass;
pub use xla_integration::HloOpcode;
pub use xla_integration::LayoutOptimizationPass;
pub use xla_integration::MemoryAllocationOptimizationPass;
pub use xla_integration::OperationFusionPass;
pub use xla_integration::ParallelizationAnalysisPass;
pub use xla_integration::PassStatistics;
pub use xla_integration::XlaBuilder;
pub use xla_integration::XlaComputation;
pub use xla_integration::XlaConfig;
pub use xla_integration::XlaMetadata;
pub use xla_integration::XlaNode;
pub use xla_integration::XlaNodeId;
pub use xla_integration::XlaPassManager;
pub use xla_integration::XlaTarget;

Modules§

alloc_optimizer
Heap Allocation Optimizer for ToRSh Hot Paths
api_compat
API Compatibility and Deprecation Management
backend_detection
Backend feature detection system for runtime capability discovery
cache_oblivious
Cache-Oblivious Algorithms for Shape Operations
chunking
Intelligent chunking utilities for optimal tensor operations
compression
Tensor compression schemes and pruning metadata for ToRSh Core
debug_validation
Debug-Only Validation Checks with Runtime Configuration
device
Device abstraction and management system
distributed
dtype
error
Error types for ToRSh - Clean Modular Interface
error_codes
Standard Error Codes for Interoperability
error_recovery
Error recovery mechanisms for graceful degradation
examples
Comprehensive examples for torsh-core modules
federated
ffi
FFI-safe type wrappers for C/C++ integration
gpu_shape_ops
GPU-Accelerated Shape Operations for Very Large Tensors
hdf5_metadata
HDF5 metadata support for scientific computing workflows
health
Health Check System for ToRSh Service Integration
ieee754_compliance
IEEE 754 Compliance Tests and Utilities
inspector
Tensor Inspector
interop
Interoperability traits and utilities for ToRSh
jax_transforms
JAX-Style Function Transformations for Functional Programming
layout_optimizer
Automatic Memory Layout Optimization based on Access Patterns
memory_debug
Memory debugging and allocation tracking tools for ToRSh
memory_monitor
Advanced system memory monitoring with platform-specific APIs
memory_visualization
Memory Allocation Visualization Tools
mlir_integration
MLIR (Multi-Level Intermediate Representation) Integration
ndarray
Array operations module - USE THIS instead of ndarray
neuromorphic
numeric
Numerical traits module - USE THIS instead of num-traits
op_trace
Operation Tracing System for Step-by-Step Debugging
parallel
Parallel operations module - USE THIS instead of rayon
perf_metrics
Advanced Performance Metrics for ToRSh Operations
perf_monitor
Real-Time Performance Monitoring
perf_regression
Performance regression testing framework
prelude
Prelude module for convenient imports
profiling
Performance Profiling Hooks for ToRSh Operations
random
Random number generation module - USE THIS instead of rand
runtime_config
Runtime Configuration System for ToRSh Core
scirs2_bridge
SciRS2 Integration Bridge for Optimized Data Transfer and Error Mapping
shape
Shape and stride utilities for tensors
shape_debug
Shape Debugging Utilities
shape_graph
Graph-Based Shape Inference for Optimization
shape_utils
Shape Utility Functions for Common Patterns
shape_validation
Development-time Shape Validation with Detailed Error Messages
simd_arm
ARM NEON SIMD optimizations for ToRSh core operations
sparse
storage
Storage system for tensor data management
symbolic_shape
Symbolic shape support for dynamic graphs
telemetry
Telemetry and Structured Logging System for ToRSh
tensor_expr
Tensor Expression Templates for Compile-Time Optimization
tensor_network
Tensor Network Representations for Specialized Applications
type_level_ad
type_level_shapes
Type-Level Shape Verification with Advanced Compile-Time Guarantees
webgpu
xla_integration
TensorFlow XLA (Accelerated Linear Algebra) Integration

Macros§

debug
deprecated
Macro to mark a function as deprecated
error
impl_custom_tensor_element
Helper macro for easily implementing CustomTensorElement for simple types
index_error
Convenience macro for index errors
info
log
Log a message with structured metadata
profile_operation
Convenience macro for profiling operations
profile_shape_op
Macro for easy shape operation profiling
shape_mismatch_error
Convenience macro for shape mismatch errors
time_operation
Macro for easy timing scope creation
torsh_assert_essential
Essential assertion (always runs unless debug level is None)
torsh_debug_assert
Convenience macros for debug assertions with configurable levels
torsh_debug_assert_verbose
Verbose debug assertion (only in Verbose or Paranoid mode)
torsh_error_with_location
Convenience macros for error creation with location information
trace
Convenience macros for different log levels
validate_shapes
Convenience macros for validation
warn

Constants§

VERSION
VERSION_MAJOR
VERSION_MINOR
VERSION_PATCH