Skip to main content

Crate ipfrs_tensorlogic

Crate ipfrs_tensorlogic 

Source
Expand description

IPFRS TensorLogic - Integration with TensorLogic IR

This crate provides comprehensive integration between IPFRS and TensorLogic including:

§Core Features

  • IR (Intermediate Representation): Serialization and storage of logic terms
  • Term and Predicate Storage: Content-addressed storage for logical statements
  • Distributed Reasoning: Query caching, goal decomposition, and proof assembly
  • Zero-Copy Tensor Transport: Apache Arrow integration for efficient data sharing
  • Safetensors Support: Read/write Safetensors format for ML models
  • PyTorch Checkpoint Support: Load/save PyTorch .pt/.pth model checkpoints
  • Shared Memory: Cross-process memory mapping for large tensors
  • Gradient Management: Compression, aggregation, and differential privacy
  • Model Version Control: Git-like versioning for ML models
  • Provenance Tracking: Complete lineage tracking for datasets and models
  • Computation Graphs: IPLD-based graph storage with optimization
  • Device Management: Heterogeneous device support with adaptive batch sizing
  • FFI Profiling: Overhead measurement and bottleneck identification
  • Allocation Optimization: Buffer pooling and zero-copy conversions
  • GPU Support: Stub implementation for future CUDA/OpenCL/Vulkan integration

§Performance Targets

  • FFI call overhead: < 1μs
  • Zero-copy tensor access: < 100ns
  • Query cache lookup: < 1μs
  • Term serialization: < 10μs for small terms

§Examples

§Basic Term and Predicate Creation

use ipfrs_tensorlogic::{Term, Predicate, Constant};

// Create terms
let alice = Term::Const(Constant::String("Alice".to_string()));
let bob = Term::Const(Constant::String("Bob".to_string()));
let x = Term::Var("X".to_string());

// Create a predicate: parent(Alice, Bob)
let pred = Predicate::new("parent".to_string(), vec![alice, bob]);
assert!(pred.is_ground());

§Zero-Copy Tensor Operations

use ipfrs_tensorlogic::{ArrowTensor, ArrowTensorStore};

// Create a tensor from f32 data
let data: Vec<f32> = vec![1.0, 2.0, 3.0, 4.0];
let tensor = ArrowTensor::from_slice_f32("my_tensor", vec![4], &data);

// Zero-copy access to the data
let slice = tensor.as_slice_f32().expect("example: should succeed in docs");
assert_eq!(slice[0], 1.0);

// Create a tensor store
let mut store = ArrowTensorStore::new();
store.insert(tensor);
assert_eq!(store.len(), 1);

§Query Caching

use ipfrs_tensorlogic::{QueryCache, QueryKey};

// Create a cache with capacity 100
let cache = QueryCache::new(100);

// Insert a query result
let key = QueryKey {
    predicate_name: "parent".to_string(),
    ground_args: vec![],
};
cache.insert(key.clone(), vec![]);

// Retrieve from cache
let result = cache.get(&key);
assert!(result.is_some());

§Gradient Compression

use ipfrs_tensorlogic::GradientCompressor;

let gradient = vec![0.1, 0.5, 0.01, 0.8, 0.02];

// Top-k compression (keep largest 2 values)
let sparse = GradientCompressor::top_k(&gradient, vec![5], 2).expect("example: should succeed in docs");
assert_eq!(sparse.nnz(), 2); // Only 2 non-zero elements

// Quantization to int8
let quantized = GradientCompressor::quantize(&gradient, vec![5]);
assert!(quantized.compression_ratio() > 1.0);

§Device-Aware Batch Sizing

use ipfrs_tensorlogic::{DeviceCapabilities, AdaptiveBatchSizer};
use std::sync::Arc;

// Detect device capabilities
let caps = DeviceCapabilities::detect().expect("example: should succeed in docs");
println!("Device: {:?}, Memory: {} GB",
         caps.device_type,
         caps.memory.total_bytes / 1024 / 1024 / 1024);

// Create adaptive batch sizer
let sizer = AdaptiveBatchSizer::new(Arc::new(caps))
    .with_min_batch_size(1)
    .with_max_batch_size(256);

// Calculate optimal batch size
let model_size = 500 * 1024 * 1024;  // 500MB model
let item_size = 256 * 1024;          // 256KB per item
let batch_size = sizer.calculate(item_size, model_size);
println!("Optimal batch size: {}", batch_size);

§FFI Profiling

use ipfrs_tensorlogic::{FfiProfiler, global_profiler};

let profiler = FfiProfiler::new();

// Profile a function call
{
    let _guard = profiler.start("my_ffi_function");
    // Your FFI code here
}

// Get statistics
let stats = profiler.get_stats("my_ffi_function").expect("example: should succeed in docs");
println!("Calls: {}, Avg: {:?}", stats.call_count, stats.avg_duration);

// Use global profiler
let global = global_profiler();
let _guard = global.start("global_operation");

§Buffer Pooling

use ipfrs_tensorlogic::BufferPool;

let pool = BufferPool::new(4096, 10); // 4KB buffers, max 10 pooled

// Acquire buffer from pool
let mut buffer = pool.acquire();
buffer.as_mut().extend_from_slice(&[1, 2, 3, 4]);

// Buffer automatically returned to pool when dropped
drop(buffer);
assert!(pool.size() > 0); // Buffer available for reuse

§Zero-Copy Conversions

use ipfrs_tensorlogic::ZeroCopyConverter;

let floats: Vec<f32> = vec![1.0, 2.0, 3.0, 4.0];

// Zero-copy conversion to bytes
let bytes = ZeroCopyConverter::slice_to_bytes(&floats);
assert_eq!(bytes.len(), 16); // 4 floats * 4 bytes

// Zero-copy conversion back
let floats_back: &[f32] = ZeroCopyConverter::bytes_to_slice(bytes);
assert_eq!(floats, floats_back);

§Safetensors Multi-Dtype Support

use ipfrs_tensorlogic::{SafetensorsWriter, SafetensorsReader, ArrowTensor};
use bytes::Bytes;

// Create a model with multiple data types
let mut writer = SafetensorsWriter::new();

// Add float32 weights
writer.add_f32("layer1.weights", vec![128, 64], &vec![0.1; 8192]);

// Add float64 biases for high precision
writer.add_f64("layer1.bias", vec![64], &vec![0.01; 64]);

// Add int32 indices
writer.add_i32("vocab_indices", vec![1000], &vec![42; 1000]);

// Add int64 large IDs
writer.add_i64("entity_ids", vec![100], &vec![1000000; 100]);

// Serialize and read back
let bytes = writer.serialize().expect("example: should succeed in docs");
let reader = SafetensorsReader::from_bytes(Bytes::from(bytes)).expect("example: should succeed in docs");

// Load as Arrow tensors for zero-copy access
let weights = reader.load_as_arrow("layer1.weights").expect("example: should succeed in docs");
let bias = reader.load_as_arrow("layer1.bias").expect("example: should succeed in docs");
let indices = reader.load_as_arrow("vocab_indices").expect("example: should succeed in docs");
let ids = reader.load_as_arrow("entity_ids").expect("example: should succeed in docs");

assert!(weights.as_slice_f32().is_some());
assert!(bias.as_slice_f64().is_some());
assert!(indices.as_slice_i32().is_some());
assert!(ids.as_slice_i64().is_some());

§Memory Profiling

use ipfrs_tensorlogic::MemoryProfiler;
use std::time::Duration;

let profiler = MemoryProfiler::new();

{
    let _guard = profiler.start_tracking("tensor_allocation");
    let data: Vec<f32> = vec![1.0; 1000000]; // ~4 MB
    std::thread::sleep(Duration::from_millis(10));
    drop(data);
}

let stats = profiler.get_stats("tensor_allocation").expect("example: should succeed in docs");
assert_eq!(stats.track_count, 1);
assert!(stats.total_duration >= Duration::from_millis(10));

// Generate and print a report
let report = profiler.generate_report();
println!("Total operations tracked: {}", report.total_operations);

§Model Quantization

use ipfrs_tensorlogic::{QuantizedTensor, QuantizationConfig};

// Per-tensor INT8 symmetric quantization
let weights = vec![0.5, -0.3, 0.8, -0.1];
let config = QuantizationConfig::int8_symmetric();
let quantized = QuantizedTensor::quantize_per_tensor(&weights, vec![4], config).expect("example: should succeed in docs");

// Dequantize back to f32
let dequantized = quantized.dequantize();
assert_eq!(dequantized.len(), 4);

// Check compression ratio
println!("Compression: {:.2}x", quantized.compression_ratio());

§More Examples

For complete examples, see the examples/ directory:

  • basic_reasoning.rs - TensorLogic inference and backward chaining
  • query_optimization.rs - Materialized views and query caching
  • proof_storage.rs - Proof fragment management and compression
  • proof_explanation_demo.rs - Automatic proof explanation in natural language (multiple styles)
  • model_versioning.rs - Git-like version control for ML models
  • model_quantization.rs - Model quantization for edge deployment (INT4/INT8, per-channel, dynamic)
  • tensor_storage.rs - Safetensors and Arrow integration
  • device_aware_training.rs - Device detection and adaptive batching
  • federated_learning.rs - Gradient compression and differential privacy
  • allocation_optimization.rs - Buffer pooling and zero-copy techniques
  • ffi_profiling.rs - FFI overhead measurement
  • distributed_graph_execution.rs - Graph partitioning across multiple workers
  • memory_profiling.rs - Memory usage tracking and profiling
  • visualization_demo.rs - Graph and proof visualization with DOT format

Re-exports§

pub use kernel_registry::KernelDescriptor;
pub use kernel_registry::KernelPrecision;
pub use kernel_registry::KernelQuery;
pub use kernel_registry::KernelRegistryStats;
pub use kernel_registry::KernelTarget;
pub use kernel_registry::TensorKernelRegistry;
pub use constraint_solver::Assignment as CspAssignment;
pub use constraint_solver::Constraint as CspConstraint;
pub use constraint_solver::ConstraintSolver;
pub use constraint_solver::CspError;
pub use constraint_solver::CspStats;
pub use constraint_solver::CspVarId;
pub use constraint_solver::CspVariable;
pub use constraint_solver::Domain as CspDomain;
pub use constraint_solver::SolverConfig as CspSolverConfig;
pub use constraint_solver::SolverResult as CspSolverResult;
pub use early_stopping::EarlyStoppingConfig;
pub use early_stopping::EarlyStoppingMonitor;
pub use early_stopping::EarlyStoppingStats;
pub use early_stopping::EpochMetrics;
pub use early_stopping::StopCriterion;
pub use early_stopping::StopDecision;
pub use memory_layout::LayoutDescriptor;
pub use memory_layout::LayoutOrder;
pub use memory_layout::LayoutStats;
pub use memory_layout::MemoryLayoutShape;
pub use memory_layout::TensorMemoryLayout;
pub use memory_layout::TensorShape as MemoryTensorShape;
pub use feature_extractor::ExtractedFeature;
pub use feature_extractor::ExtractionResult;
pub use feature_extractor::ExtractorConfig;
pub use feature_extractor::ExtractorStats;
pub use feature_extractor::FeatureKind;
pub use feature_extractor::TensorFeatureExtractor;
pub use ml_feature_extractor::fit_minmax_scaler;
pub use ml_feature_extractor::fit_onehot;
pub use ml_feature_extractor::fit_standard_scaler;
pub use ml_feature_extractor::ExtractedFeatures;
pub use ml_feature_extractor::FePipelineStats;
pub use ml_feature_extractor::FeatureError;
pub use ml_feature_extractor::FeatureExtractor;
pub use ml_feature_extractor::FeatureSpec;
pub use ml_feature_extractor::FeatureTransform;
pub use ml_feature_extractor::FeatureValue;
pub use op_dispatcher::BackendKind;
pub use op_dispatcher::BackendRegistration;
pub use op_dispatcher::BackendStats;
pub use op_dispatcher::DispatchOp;
pub use op_dispatcher::DispatchResult;
pub use op_dispatcher::DispatcherStats;
pub use op_dispatcher::TensorOpDispatcher;
pub use op_fusion::FusedOp;
pub use op_fusion::FusionPlan;
pub use op_fusion::FusionStats;
pub use op_fusion::TensorOp as FusionTensorOp;
pub use op_fusion::TensorOpFusion;
pub use memory_pool::MemoryPoolStats;
pub use memory_pool::PoolSlot;
pub use memory_pool::SizeClass;
pub use memory_pool::TensorMemoryPool;
pub use memory_pool::BlockPoolStats;
pub use memory_pool::BlockStatus;
pub use memory_pool::MemoryBlock;
pub use memory_pool::PoolConfig;
pub use memory_pool::TensorBlockPool;
pub use rule_index::IndexedRule;
pub use rule_index::RuleArity;
pub use rule_index::RuleIndexStats;
pub use rule_index::RuleQuery;
pub use rule_index::TensorRuleIndex;
pub use inference_scheduler::InferenceJob;
pub use inference_scheduler::JobStatus;
pub use inference_scheduler::SchedulerConfig;
pub use inference_scheduler::SchedulerStats;
pub use inference_scheduler::TensorInferenceScheduler;
pub use query_optimizer::estimated_cost;
pub use query_optimizer::OptimizationResult;
pub use query_optimizer::OptimizationRule;
pub use query_optimizer::OptimizerStats;
pub use query_optimizer::QueryNode;
pub use query_optimizer::TensorQueryOptimizer;
pub use flow_controller::FlowControllerConfig;
pub use flow_controller::FlowItem;
pub use flow_controller::FlowPriority;
pub use flow_controller::FlowState;
pub use flow_controller::FlowStats;
pub use flow_controller::TensorFlowController;
pub use rule_validator::RuleSpec;
pub use rule_validator::TensorRuleValidator;
pub use rule_validator::ValidationError;
pub use rule_validator::ValidationResult;
pub use rule_validator::ValidatorConfig;
pub use dependency_graph::DependencyEdge;
pub use dependency_graph::DependencyKind;
pub use dependency_graph::DirtySet;
pub use dependency_graph::GraphStats;
pub use dependency_graph::TensorDependencyGraph;
pub use checkpoint_manager::crc32;
pub use checkpoint_manager::CheckpointPruner;
pub use checkpoint_manager::CheckpointRecord;
pub use checkpoint_manager::CheckpointValidator;
pub use checkpoint_manager::RetentionPolicy;
pub use checkpoint_manager::ValidationError as CheckpointValidationError;
pub use distributed_backward_chainer::Binding;
pub use distributed_backward_chainer::DistributedBackwardChainer;
pub use multi_hop::HopRecord;
pub use multi_hop::HopTrace;
pub use multi_hop::MultiHopConfig;
pub use multi_hop::MultiHopResolver;
pub use multi_hop::MultiHopResult;
pub use multi_hop::VisitedSet;
pub use proof_tree::ProofNode;
pub use proof_tree::ProofTree;
pub use proof_tree_streaming::ProofTreeStreamSummary;
pub use proof_tree_streaming::ProofTreeStreamer;
pub use proof_tree_streaming::ProofTreeUpdate;
pub use proof_tree_streaming::ProofTreeUpdateSink;
pub use allocation_optimizer::AdaptiveBuffer;
pub use allocation_optimizer::AllocationError;
pub use allocation_optimizer::BufferPool;
pub use allocation_optimizer::PooledBuffer;
pub use allocation_optimizer::StackBuffer;
pub use allocation_optimizer::TypedBufferPool;
pub use allocation_optimizer::TypedPooledBuffer;
pub use allocation_optimizer::ZeroCopyConverter;
pub use tensor_pool::bucket_for;
pub use tensor_pool::PooledBuffer as TensorPoolBuffer;
pub use tensor_pool::TensorPool;
pub use tensor_pool::TensorPoolConfig;
pub use tensor_pool::TensorPoolSnapshot;
pub use tensor_pool::TensorPoolStats;
pub use tensor_pool::NUM_BUCKETS;
pub use arrow::ArrowTensor;
pub use arrow::ArrowTensorStore;
pub use arrow::TensorDtype;
pub use arrow::TensorMetadata;
pub use arrow::ZeroCopyAccessor;
pub use cache::CacheManager;
pub use cache::CacheStats;
pub use cache::CacheStatsSnapshot;
pub use cache::CombinedCacheStats;
pub use cache::QueryCache;
pub use cache::QueryKey;
pub use cache::RemoteFactCache;
pub use computation_graph::BatchScheduler;
pub use computation_graph::ComputationGraph;
pub use computation_graph::DistributedExecutor;
pub use computation_graph::ExecutionBatch;
pub use computation_graph::GraphError;
pub use computation_graph::GraphNode;
pub use computation_graph::GraphOptimizer;
pub use computation_graph::GraphPartition;
pub use computation_graph::LazyCache;
pub use computation_graph::NodeAssignment;
pub use computation_graph::ParallelExecutor;
pub use computation_graph::StreamChunk;
pub use computation_graph::StreamingExecutor;
pub use computation_graph::TensorOp;
pub use datalog::parse_fact;
pub use datalog::parse_query;
pub use datalog::parse_rule;
pub use datalog::DatalogParser;
pub use datalog::ParseError;
pub use datalog::Statement;
pub use device::AdaptiveBatchSizer;
pub use device::CpuInfo;
pub use device::DeviceArch;
pub use device::DeviceCapabilities;
pub use device::DeviceError;
pub use device::DevicePerformanceTier;
pub use device::DeviceProfiler;
pub use device::DeviceType;
pub use device::MemoryInfo;
pub use ffi_profiler::global_profiler;
pub use ffi_profiler::FfiCallGuard;
pub use ffi_profiler::FfiCallStats;
pub use ffi_profiler::FfiProfiler;
pub use ffi_profiler::OverheadSummary;
pub use ffi_profiler::ProfilingReport;
pub use feed_forward::FFLayer;
pub use feed_forward::FFStats;
pub use feed_forward::FeedForwardActivation;
pub use feed_forward::FeedForwardConfig;
pub use feed_forward::FeedForwardNetwork;
pub use gpu::GpuBackend;
pub use gpu::GpuBuffer;
pub use gpu::GpuDevice;
pub use gpu::GpuError;
pub use gpu::GpuExecutor;
pub use gpu::GpuKernel;
pub use gpu::GpuMemoryManager;
pub use gradient::clip_gradient_norm;
pub use gradient::federated_average;
pub use gradient::load_gradient_from_arrow;
pub use gradient::store_gradient_as_arrow;
pub use gradient::AggregationMethod;
pub use gradient::BackwardPassConfig;
pub use gradient::BackwardPassCoordinator;
pub use gradient::BackwardPassStats;
pub use gradient::BackwardPassStep;
pub use gradient::BackwardStepStatus;
pub use gradient::ClientInfo;
pub use gradient::ClientState;
pub use gradient::ComputationGraphError;
pub use gradient::ComputationGraphStore;
pub use gradient::ComputationNode;
pub use gradient::ConvergenceDetector;
pub use gradient::DPMechanism;
pub use gradient::DifferentialPrivacy;
pub use gradient::DistributedGradientAccumulator;
pub use gradient::FederatedRound;
pub use gradient::GradientAggregator;
pub use gradient::GradientCheckpoint;
pub use gradient::GradientCompressor;
pub use gradient::GradientDelta;
pub use gradient::GradientError;
pub use gradient::GradientVerifier;
pub use gradient::LayerGradient;
pub use gradient::ModelSyncProtocol;
pub use gradient::PrivacyBudget as GradientPrivacyBudget;
pub use gradient::QuantizedGradient;
pub use gradient::SecureAggregation;
pub use gradient::SparseGradient;
pub use ir::Constant;
pub use ir::KnowledgeBase;
pub use ir::KnowledgeBaseStats;
pub use ir::Predicate;
pub use ir::Rule;
pub use ir::Term;
pub use ir::TermRef;
pub use memory_profiler::MemoryProfiler;
pub use memory_profiler::MemoryProfilingReport;
pub use memory_profiler::MemoryStats;
pub use memory_profiler::MemoryTrackingGuard;
pub use optimizer::OptimizationRecommendation;
pub use optimizer::PlanNode;
pub use optimizer::PredicateStats;
pub use optimizer::QueryOptimizer;
pub use optimizer::QueryPlan;
pub use reasoning::apply_subst_predicate;
pub use reasoning::rename_rule_vars;
pub use reasoning::unify_predicates;
pub use reasoning::CycleDetector;
pub use reasoning::DistributedReasoner;
pub use reasoning::GoalDecomposition;
pub use reasoning::InferenceEngine;
pub use reasoning::MemoizedInferenceEngine;
pub use reasoning::Proof;
pub use reasoning::ProofRule;
pub use reasoning::Substitution;
pub use recursive_reasoning::FixpointEngine;
pub use recursive_reasoning::StratificationAnalyzer;
pub use recursive_reasoning::StratificationResult;
pub use recursive_reasoning::TableStats;
pub use recursive_reasoning::TabledInferenceEngine;
pub use remote_reasoning::DistributedGoalResolver;
pub use remote_reasoning::DistributedInferenceSession;
pub use remote_reasoning::DistributedProofAssembler;
pub use remote_reasoning::DistributedReasonerConfig;
pub use remote_reasoning::DistributedReasonerV2;
pub use remote_reasoning::FactDiscoveryRequest;
pub use remote_reasoning::FactDiscoveryResponse;
pub use remote_reasoning::GoalResolutionRequest;
pub use remote_reasoning::GoalResolutionResponse;
pub use remote_reasoning::IncrementalLoadRequest;
pub use remote_reasoning::IncrementalLoadResponse;
pub use remote_reasoning::InferenceRequest;
pub use remote_reasoning::InferenceResponse;
pub use remote_reasoning::InferenceResultStream;
pub use remote_reasoning::MockRemoteKnowledgeProvider;
pub use remote_reasoning::PartialResult;
pub use remote_reasoning::QueryRequest;
pub use remote_reasoning::QueryResponse;
pub use remote_reasoning::ReasoningError;
pub use remote_reasoning::RemoteKnowledgeProvider;
pub use remote_reasoning::RemoteReasoningError;
pub use remote_reasoning::RemoteResult;
pub use remote_reasoning::SessionMetrics;
pub use remote_reasoning::SessionStats;
pub use proof_storage::ProofAssembler;
pub use proof_storage::ProofFragment;
pub use proof_storage::ProofFragmentRef;
pub use proof_storage::ProofFragmentStore;
pub use proof_storage::ProofMetadata;
pub use proof_storage::RuleRef;
pub use proof_explanation::ExplanationConfig;
pub use proof_explanation::ExplanationStyle;
pub use proof_explanation::FragmentProofExplainer;
pub use proof_explanation::ProofExplainer;
pub use proof_explanation::ProofExplanationBuilder;
pub use provenance::Attribution;
pub use provenance::DatasetProvenance;
pub use provenance::Hyperparameters;
pub use provenance::License;
pub use provenance::LineageTrace;
pub use provenance::ProvenanceError;
pub use provenance::ProvenanceGraph;
pub use provenance::TrainingProvenance;
pub use pytorch_checkpoint::CheckpointMetadata;
pub use pytorch_checkpoint::OptimizerState;
pub use pytorch_checkpoint::ParamState;
pub use pytorch_checkpoint::PyTorchCheckpoint;
pub use pytorch_checkpoint::StateDict;
pub use pytorch_checkpoint::TensorData;
pub use quantization::CalibrationMethod;
pub use quantization::DynamicQuantizer;
pub use quantization::QuantizationConfig;
pub use quantization::QuantizationError;
pub use quantization::QuantizationGranularity;
pub use quantization::QuantizationParams;
pub use quantization::QuantizationScheme;
pub use quantization::QuantizedTensor;
pub use safetensors_support::ChunkedModelStorage;
pub use safetensors_support::ModelSummary;
pub use safetensors_support::SafetensorError;
pub use safetensors_support::SafetensorsReader;
pub use safetensors_support::SafetensorsWriter;
pub use safetensors_support::TensorInfo;
pub use shared_memory::SharedMemoryError;
pub use shared_memory::SharedMemoryPool;
pub use shared_memory::SharedTensorBuffer;
pub use shared_memory::SharedTensorBufferReadOnly;
pub use shared_memory::SharedTensorInfo;
pub use ipld_codec::block_to_fact;
pub use ipld_codec::block_to_kb;
pub use ipld_codec::block_to_rule;
pub use ipld_codec::fact_cid;
pub use ipld_codec::fact_ipld_to_predicate;
pub use ipld_codec::fact_to_block;
pub use ipld_codec::kb_to_block;
pub use ipld_codec::predicate_to_fact_ipld;
pub use ipld_codec::predicate_to_term_ipld;
pub use ipld_codec::rule_cid;
pub use ipld_codec::rule_ipld_to_rule;
pub use ipld_codec::rule_to_block;
pub use ipld_codec::rule_to_rule_ipld;
pub use ipld_codec::term_ipld_to_predicate;
pub use ipld_codec::FactIpld;
pub use ipld_codec::KnowledgeBaseIpld;
pub use ipld_codec::RuleIpld;
pub use ipld_codec::TermIpld;
pub use ipld_path::IpldPathResolver;
pub use ipld_path::IpldPathValue;
pub use ipld_path::PathError;
pub use storage::FactSnapshot;
pub use storage::KnowledgeBaseSnapshot;
pub use storage::RuleSnapshot;
pub use storage::TensorLogicError;
pub use storage::TensorLogicPersistenceConfig;
pub use storage::TensorLogicStore;
pub use storage::TensorLogicStoreStats;
pub use inference_cache::hash_goal as inference_hash_goal;
pub use inference_cache::CacheStats as InferenceCacheStats;
pub use inference_cache::CachedResult;
pub use inference_cache::InferenceCache;
pub use inference_cache::InferenceCacheKey;
pub use versioned_cache::CacheEntry;
pub use versioned_cache::CacheError;
pub use versioned_cache::CacheKey;
pub use versioned_cache::CacheStatsSnapshot as VersionedCacheStatsSnapshot;
pub use versioned_cache::VersionedInferenceCache;
pub use kb_federation::export_kb_as_cid;
pub use kb_federation::import_remote_kb;
pub use kb_federation::merge_knowledge_bases;
pub use kb_federation::KbConflict;
pub use kb_federation::KbMergeDiff;
pub use utils::KnowledgeBaseUtils;
pub use utils::PredicateBuilder;
pub use utils::QueryUtils;
pub use utils::RuleBuilder;
pub use utils::TermUtils;
pub use version_control::Branch;
pub use version_control::LayerDiff;
pub use version_control::ModelCommit;
pub use version_control::ModelDiff;
pub use version_control::ModelDiffer;
pub use version_control::ModelRepository;
pub use version_control::VersionControlError;
pub use rule_versioning::ConflictResolver;
pub use rule_versioning::ConflictStrategy;
pub use rule_versioning::ResolvedRuleSet;
pub use rule_versioning::RuleSetDiff;
pub use rule_versioning::RuleSetVersion;
pub use rule_versioning::VersionedRuleSet;
pub use session_manager::DistributedSessionManager;
pub use session_manager::PeerId as SessionPeerId;
pub use session_manager::SessionError;
pub use session_manager::SessionId;
pub use session_manager::SessionMetrics as SessionManagerMetrics;
pub use session_manager::SessionMetricsSnapshot;
pub use session_manager::SessionStatus;
pub use session_manager::MAX_CONCURRENT_SESSIONS;
pub use visualization::GraphVisualizer;
pub use visualization::ProofVisualizer;
pub use privacy_budget::BudgetError;
pub use privacy_budget::BudgetSnapshot;
pub use privacy_budget::PerRoundBudget;
pub use privacy_budget::PrivacyBudget as DpPrivacyBudget;
pub use privacy_budget::RenyiAccountant;
pub use privacy_budget::RoundGuard;
pub use kg_traversal::EdgeType;
pub use kg_traversal::KgEdge;
pub use kg_traversal::KgError;
pub use kg_traversal::KgNode;
pub use kg_traversal::KnowledgeGraph;
pub use kg_traversal::KnowledgeGraphTraverser;
pub use kg_traversal::NodeType;
pub use consensus::ConsensusError;
pub use consensus::ConsensusStats;
pub use consensus::ConsensusStatsSnapshot;
pub use consensus::PeerVote;
pub use consensus::QuorumPolicy;
pub use consensus::QuorumResult;
pub use consensus::RoundConsensusTracker;
pub use consensus::RoundId;
pub use consensus::RoundStatus;
pub use consensus::Vote;
pub use codec_registry::CodecDescriptor;
pub use codec_registry::CodecError;
pub use codec_registry::CodecId;
pub use codec_registry::CodecNegotiationRecord;
pub use codec_registry::CodecRegistry;
pub use codec_registry::SpeedClass;
pub use audit_log::AuditEntry;
pub use audit_log::AuditError;
pub use audit_log::AuditEvent;
pub use audit_log::AuditStats;
pub use audit_log::AuditStatsSnapshot;
pub use audit_log::InferenceAuditLog;
pub use rule_dependency::DepError;
pub use rule_dependency::DependencyType;
pub use rule_dependency::EvaluationSchedule;
pub use rule_dependency::RuleDependency;
pub use rule_dependency::RuleDependencyGraph;
pub use rule_dependency::RuleId;
pub use gradient_sparsify::DeltaEncoder;
pub use gradient_sparsify::DeltaStats;
pub use gradient_sparsify::GradientDelta as GradientDeltaV2;
pub use gradient_sparsify::GradientSparsifier;
pub use gradient_sparsify::SparseGradient as SparseGradientV2;
pub use gradient_sparsify::SparsifierStats;
pub use gradient_sparsify::SparsityConfig;
pub use gradient_noise::GradientNoiseConfig;
pub use gradient_noise::GradientNoiseInjector;
pub use gradient_noise::NoiseSample;
pub use gradient_noise::NoiseStats;
pub use gradient_noise::NoiseType;
pub use gradient_clipper::ClipperStats;
pub use gradient_clipper::ClippingResult;
pub use gradient_clipper::ClippingStrategy;
pub use gradient_clipper::GradientTensor;
pub use gradient_clipper::TensorGradientClipper;
pub use proof_serializer::ProofNodeInput;
pub use proof_serializer::ProofNodeRecord;
pub use proof_serializer::ProofSerError;
pub use proof_serializer::ProofSerializer;
pub use proof_serializer::ProofSerializerStats;
pub use proof_serializer::ProofSerializerStatsSnapshot;
pub use proof_serializer::ProofTreeInput;
pub use proof_serializer::SerializedProof;
pub use tensor_arena::ArenaError;
pub use tensor_arena::ArenaRegion;
pub use tensor_arena::ArenaSlice;
pub use tensor_arena::ArenaStats;
pub use tensor_arena::TensorArena;
pub use proof_cache::fnv1a_hash;
pub use proof_cache::CachedProof;
pub use proof_cache::ProofCacheConfig;
pub use proof_cache::ProofCacheKey;
pub use proof_cache::ProofCacheStats;
pub use proof_cache::ProofCachingLayer;
pub use state_snapshot::fnv1a_u64;
pub use state_snapshot::FieldData;
pub use state_snapshot::SnapshotDelta;
pub use state_snapshot::SnapshotField;
pub use state_snapshot::StateSnapshot;
pub use state_snapshot::StateSnapshotStats;
pub use state_snapshot::TensorStateSnapshot;
pub use provenance_tracker::ProvenanceChain;
pub use provenance_tracker::ProvenanceKind;
pub use provenance_tracker::ProvenanceRecord;
pub use provenance_tracker::ProvenanceStats;
pub use provenance_tracker::TensorProvenanceTracker;
pub use execution_tracer::TensorExecutionTracer;
pub use execution_tracer::TraceEvent;
pub use execution_tracer::TraceEventKind;
pub use execution_tracer::TraceSummary;
pub use execution_tracer::TracerConfig;
pub use execution_tracer::TracerStats;
pub use optimization_history::ConvergenceStatus;
pub use optimization_history::HistoryStats;
pub use optimization_history::OptimizationHistoryConfig;
pub use optimization_history::OptimizationStep;
pub use optimization_history::TensorOptimizationHistory;
pub use checkpoint_scheduler::CheckpointRecord as SchedulerCheckpointRecord;
pub use checkpoint_scheduler::CheckpointTrigger;
pub use checkpoint_scheduler::SchedulerConfig as CheckpointSchedulerConfig;
pub use checkpoint_scheduler::SchedulerStats as CheckpointSchedulerStats;
pub use checkpoint_scheduler::TensorCheckpointScheduler;
pub use grad_accumulator::AccumulationMode;
pub use grad_accumulator::AccumulatorConfig as GradAccumulatorConfig;
pub use grad_accumulator::AccumulatorStats as GradAccumulatorStats;
pub use grad_accumulator::GradBuffer;
pub use grad_accumulator::TensorGradAccumulator;
pub use autograd::AutogradGraph;
pub use autograd::AutogradNode;
pub use autograd::AutogradOp;
pub use autograd::NodeId;
pub use slice_view::BroadcastShape;
pub use slice_view::SliceRange;
pub use slice_view::SliceViewStats;
pub use slice_view::TensorSliceView;
pub use slice_view::ViewDescriptor;
pub use batch_norm::BatchNormConfig;
pub use batch_norm::BatchNormStats;
pub use batch_norm::NormMode;
pub use batch_norm::TensorBatchNorm;
pub use quantizer::QuantBits;
pub use quantizer::QuantMode;
pub use quantizer::QuantParams;
pub use quantizer::QuantizerStats;
pub use quantizer::TensorQuantizer;
pub use tensor_quantizer::percentile as tq_percentile;
pub use tensor_quantizer::DequantizedTensor as TqDequantizedTensor;
pub use tensor_quantizer::QuantizationMode;
pub use tensor_quantizer::QuantizedTensor as TqQuantizedTensor;
pub use tensor_quantizer::QuantizerConfig;
pub use tensor_quantizer::QuantizerError;
pub use tensor_quantizer::QuantizerStats as TqQuantizerStats;
pub use tensor_quantizer::TensorQuantizer as MultiPrecisionQuantizer;
pub use checkpointer::Checkpoint;
pub use checkpointer::CheckpointConfig;
pub use checkpointer::CheckpointerStats;
pub use checkpointer::TensorCheckpointer;
pub use profiler::OpProfile;
pub use profiler::ProfileEntry;
pub use profiler::ProfilerStats as TensorProfilerStats;
pub use profiler::TensorProfiler;
pub use data_loader::DataBatch;
pub use data_loader::DataLoaderConfig;
pub use data_loader::DataLoaderStats;
pub use data_loader::TensorDataLoader;
pub use shape_inference::InferenceRule;
pub use shape_inference::ShapeInferenceStats;
pub use shape_inference::ShapeOp;
pub use shape_inference::TensorShape as InferenceTensorShape;
pub use shape_inference::TensorShapeInference;
pub use loss_function::LossConfig;
pub use loss_function::LossFunctionStats;
pub use loss_function::LossType;
pub use loss_function::Reduction;
pub use loss_function::TensorLossFunction;
pub use activation::ActivationConfig;
pub use activation::ActivationStats;
pub use activation::ActivationType;
pub use activation::TensorActivation;
pub use activation_function::ActivationConfig as AfActivationConfig;
pub use activation_function::ActivationFunction;
pub use activation_function::ActivationStats as AfActivationStats;
pub use activation_function::ActivationType as AfActivationType;
pub use regularizer::RegularizerConfig;
pub use regularizer::RegularizerStats;
pub use regularizer::RegularizerType;
pub use regularizer::TensorRegularizer;
pub use loss_scaler::LossScaler;
pub use loss_scaler::LossScalerConfig;
pub use loss_scaler::ScaleUpdatePolicy;
pub use loss_scaler::ScalerStats;
pub use lr_scheduler::LRSchedulerConfig;
pub use lr_scheduler::LRSchedulerStats;
pub use lr_scheduler::LearningRateScheduler;
pub use lr_scheduler::LrHistory;
pub use lr_scheduler::LrSchedulerState;
pub use lr_scheduler::LrStats;
pub use lr_scheduler::ScheduleType;
pub use lr_scheduler::SchedulerStrategy;
pub use lr_scheduler::TensorLRScheduler;
pub use weight_initializer::FanMode;
pub use weight_initializer::InitDistribution;
pub use weight_initializer::InitStats;
pub use weight_initializer::InitStrategy;
pub use weight_initializer::TensorShape as InitTensorShape;
pub use weight_initializer::WeightInitConfig;
pub use weight_initializer::WeightInitializer;
pub use sgd_optimizer::OptimizerType;
pub use sgd_optimizer::ParameterState;
pub use sgd_optimizer::SGDConfig;
pub use sgd_optimizer::SGDOptimizer;
pub use sgd_optimizer::SGDOptimizerStats;
pub use model_pruner::LayerWeights;
pub use model_pruner::ModelPruner;
pub use model_pruner::PrunerConfig;
pub use model_pruner::PrunerStats;
pub use model_pruner::PruningResult;
pub use model_pruner::PruningStrategy;
pub use attention_mechanism::causal_mask;
pub use attention_mechanism::matmul as attn_matmul;
pub use attention_mechanism::scaled_dot_product_attention;
pub use attention_mechanism::softmax_1d;
pub use attention_mechanism::transpose as attn_transpose;
pub use attention_mechanism::AttentionConfig;
pub use attention_mechanism::AttentionHead;
pub use attention_mechanism::AttentionMatrix;
pub use attention_mechanism::AttentionMechanism;
pub use attention_mechanism::AttentionOutput;
pub use attention_mechanism::AttnError;
pub use attention_mechanism::AttnStats;
pub use attention_mechanism::PositionalEncoding;
pub use attention_mechanism::SimpleAttentionConfig;
pub use attention_mechanism::SimpleAttentionMechanism;
pub use attention_mechanism::SimpleAttentionOutput;
pub use attention_mechanism::SimpleAttentionStats;
pub use gradient_checkpointer::fnv1a_f64_slice;
pub use gradient_checkpointer::CheckpointId;
pub use gradient_checkpointer::CheckpointerConfig;
pub use gradient_checkpointer::GcAccumulationMode;
pub use gradient_checkpointer::GcCheckpointerStats;
pub use gradient_checkpointer::GcGradientCheckpoint;
pub use gradient_checkpointer::GcGradientTensor;
pub use gradient_checkpointer::GradientCheckpointer;
pub use gradient_checkpointer::GradientCheckpointerError;
pub use model_ensemble::EnsembleConfig;
pub use model_ensemble::EnsembleError;
pub use model_ensemble::EnsembleResult;
pub use model_ensemble::EnsembleStats;
pub use model_ensemble::EnsembleStrategy;
pub use model_ensemble::ModelEnsemble;
pub use model_ensemble::ModelMember;
pub use model_ensemble::ModelPrediction;
pub use online_learner::LearnerError;
pub use online_learner::OlLossFunction;
pub use online_learner::OnlineAlgorithm;
pub use online_learner::OnlineLearner;
pub use online_learner::OnlineLearnerStats;
pub use online_learner::TrainingSample;
pub use adaptive_optimizer::AdaptiveOptimizer;
pub use adaptive_optimizer::OptimizerAlgorithm;
pub use adaptive_optimizer::OptimizerError;
pub use adaptive_optimizer::OptimizerState as AoOptimizerState;
pub use adaptive_optimizer::OptimizerStats as AoOptimizerStats;
pub use adaptive_optimizer::ParameterGroup;
pub use neural_arch_search::fnv1a_nas;
pub use neural_arch_search::NasArchitecture;
pub use neural_arch_search::NasConfig;
pub use neural_arch_search::NasEvaluationResult;
pub use neural_arch_search::NasLayerType;
pub use neural_arch_search::NasSearchStrategy;
pub use neural_arch_search::NasStats;
pub use neural_arch_search::NeuralArchitectureSearch;
pub use hyperparameter_tuner::HpConfig;
pub use hyperparameter_tuner::HpSpec;
pub use hyperparameter_tuner::HpTunerError;
pub use hyperparameter_tuner::HpType;
pub use hyperparameter_tuner::HpValue;
pub use hyperparameter_tuner::HyperparameterTuner;
pub use hyperparameter_tuner::TunerConfig;
pub use hyperparameter_tuner::TunerStats;
pub use hyperparameter_tuner::TuningResult;
pub use hyperparameter_tuner::TuningStrategy;
pub use meta_learner::MetaError;
pub use meta_learner::MetaLearner;
pub use meta_learner::MetaLearnerConfig;
pub use meta_learner::MetaLearnerStats;
pub use meta_learner::MetaParameters;
pub use meta_learner::MetaTask;
pub use meta_learner::TaskAdaptation;
pub use meta_learner::TaskExample;
pub use meta_learner::TaskId;
pub use meta_learner::TaskType;
pub use reinforcement_learner::ActionId;
pub use reinforcement_learner::Experience;
pub use reinforcement_learner::Policy;
pub use reinforcement_learner::ReinforcementLearner;
pub use reinforcement_learner::RlAlgorithm;
pub use reinforcement_learner::RlError;
pub use reinforcement_learner::RlStats;
pub use reinforcement_learner::StateId;
pub use causal_inference::CausalEdge;
pub use causal_inference::CausalEdgeType;
pub use causal_inference::CausalError;
pub use causal_inference::CausalGraph;
pub use causal_inference::CausalInferenceEngine;
pub use causal_inference::CausalNode;
pub use causal_inference::CausalNodeId;
pub use causal_inference::CausalStats;
pub use causal_inference::CounterfactualQuery;
pub use causal_inference::InferenceResult;
pub use causal_inference::Intervention;
pub use bayesian_updater::BayesError;
pub use bayesian_updater::BayesianUpdateEngine;
pub use bayesian_updater::CredibleInterval;
pub use bayesian_updater::Observation as BayesObservation;
pub use bayesian_updater::Posterior as BayesPosterior;
pub use bayesian_updater::Prior as BayesPrior;
pub use distributed_optimizer::AggregatedGradient;
pub use distributed_optimizer::AggregationStrategy;
pub use distributed_optimizer::DistOptimizerStats;
pub use distributed_optimizer::DistributedOptimizer;
pub use distributed_optimizer::GradientUpdate as DoGradientUpdate;
pub use distributed_optimizer::OptimizerDistError;
pub use distributed_optimizer::WorkerId as DoWorkerId;
pub use distributed_optimizer::WorkerState as DoWorkerState;
pub use graph_neural_network::xorshift64 as gnn_xorshift64;
pub use graph_neural_network::GnnActivation;
pub use graph_neural_network::GnnAggregation;
pub use graph_neural_network::GnnConfig;
pub use graph_neural_network::GnnEdge;
pub use graph_neural_network::GnnError;
pub use graph_neural_network::GnnLayer;
pub use graph_neural_network::GnnNodeId;
pub use graph_neural_network::GnnStats;
pub use graph_neural_network::GraphNeuralNetwork;
pub use graph_neural_network::NodeFeatures;
pub use differential_privacy::BudgetTracker as DpBudgetTracker;
pub use differential_privacy::DifferentialPrivacyEngine;
pub use differential_privacy::DpError;
pub use differential_privacy::DpQuery;
pub use differential_privacy::DpResult;
pub use differential_privacy::NoiseScale;
pub use differential_privacy::PrivacyMechanism;
pub use differential_privacy::PrivacyParameters as DpPrivacyParameters;
pub use fuzzy_logic::DefuzzMethod;
pub use fuzzy_logic::FuzzyError;
pub use fuzzy_logic::FuzzyLogicEngine;
pub use fuzzy_logic::FuzzyProposition;
pub use fuzzy_logic::FuzzyRule;
pub use fuzzy_logic::FuzzySet;
pub use fuzzy_logic::FuzzyStats;
pub use fuzzy_logic::FuzzyVariable;
pub use fuzzy_logic::InferenceMethod;
pub use fuzzy_logic::MembershipFunction;
pub use fuzzy_logic_engine::DefuzzMethod as FleDefuzzMethod;
pub use fuzzy_logic_engine::EngineConfig;
pub use fuzzy_logic_engine::EngineStats;
pub use fuzzy_logic_engine::FuzzyError as FleFuzzyError;
pub use fuzzy_logic_engine::FuzzyExpr;
pub use fuzzy_logic_engine::FuzzyLogicEngine as FleFuzzyLogicEngine;
pub use fuzzy_logic_engine::FuzzyRule as FleFuzzyRule;
pub use fuzzy_logic_engine::FuzzySet as FleFuzzySet;
pub use fuzzy_logic_engine::FuzzyVariable as FleFuzzyVariable;
pub use fuzzy_logic_engine::InferenceResult as FleInferenceResult;
pub use fuzzy_logic_engine::MembershipFunction as FleMembershipFunction;
pub use temporal_reasoning::AllenRelation;
pub use temporal_reasoning::ConstraintViolation;
pub use temporal_reasoning::TemporalConstraint;
pub use temporal_reasoning::TemporalError;
pub use temporal_reasoning::TemporalEvent;
pub use temporal_reasoning::TemporalReasoningEngine;
pub use temporal_reasoning::TemporalStats;
pub use temporal_reasoning::TimeInterval;
pub use temporal_reasoning::TimePoint;
pub use markov_decision_process::xorshift64 as mdp_xorshift64;
pub use markov_decision_process::xorshift_f64 as mdp_xorshift_f64;
pub use markov_decision_process::MarkovDecisionProcess;
pub use markov_decision_process::MdpActionId;
pub use markov_decision_process::MdpError;
pub use markov_decision_process::MdpPolicy;
pub use markov_decision_process::MdpState;
pub use markov_decision_process::MdpStateId;
pub use markov_decision_process::MdpStats;
pub use markov_decision_process::SolverConfig as MdpSolverConfig;
pub use markov_decision_process::SolverResult as MdpSolverResult;
pub use markov_decision_process::SolverType as MdpSolverType;
pub use markov_decision_process::Transition as MdpTransition;
pub use markov_decision_process::ValueFunction as MdpValueFunction;
pub use neural_symbolic::InferenceMode;
pub use neural_symbolic::IntegratorConfig;
pub use neural_symbolic::LogicalRule;
pub use neural_symbolic::NeuralSymbolicIntegrator;
pub use neural_symbolic::NsError;
pub use neural_symbolic::NsQuery;
pub use neural_symbolic::NsResult;
pub use neural_symbolic::NsStats;
pub use neural_symbolic::RuleType;
pub use neural_symbolic::Symbol;
pub use neural_symbolic::SymbolId;
pub use epistemic_logic::AccessibilityRelation;
pub use epistemic_logic::AgentId;
pub use epistemic_logic::EpistemicError;
pub use epistemic_logic::EpistemicFormula;
pub use epistemic_logic::EpistemicLogicReasoner;
pub use epistemic_logic::EpistemicStats;
pub use epistemic_logic::KripkeModel;
pub use epistemic_logic::PossibleWorld;
pub use epistemic_logic::WorldId;
pub use symbolic_neural_optimizer::parse_constraint_bound;
pub use symbolic_neural_optimizer::xorshift64 as sno_xorshift64;
pub use symbolic_neural_optimizer::ConstraintBound;
pub use symbolic_neural_optimizer::OptimizationObjective;
pub use symbolic_neural_optimizer::ParameterVector;
pub use symbolic_neural_optimizer::SnoOptimizationResult;
pub use symbolic_neural_optimizer::SnoOptimizationStep;
pub use symbolic_neural_optimizer::SnoOptimizerConfig;
pub use symbolic_neural_optimizer::SymbolicConstraint;
pub use symbolic_neural_optimizer::SymbolicNeuralOptimizer;
pub use temporal_pattern_matcher::xorshift64 as tpm_xorshift64;
pub use temporal_pattern_matcher::EventLabel;
pub use temporal_pattern_matcher::MatchResult as TpmMatchResult;
pub use temporal_pattern_matcher::MatcherConfig;
pub use temporal_pattern_matcher::MatcherError;
pub use temporal_pattern_matcher::MatcherStats;
pub use temporal_pattern_matcher::NfaState;
pub use temporal_pattern_matcher::PatternStep;
pub use temporal_pattern_matcher::RepeatSpec;
pub use temporal_pattern_matcher::TemporalConstraint as TpmTemporalConstraint;
pub use temporal_pattern_matcher::TemporalPattern;
pub use temporal_pattern_matcher::TemporalPatternMatcher;
pub use temporal_pattern_matcher::TimedEvent;
pub use causal_chain_tracer::xorshift64 as cct_xorshift64;
pub use causal_chain_tracer::CausalChain;
pub use causal_chain_tracer::CausalChainTracer;
pub use causal_chain_tracer::CausalEdge as CctCausalEdge;
pub use causal_chain_tracer::CausalNode as CctCausalNode;
pub use causal_chain_tracer::CausalRelation;
pub use causal_chain_tracer::TraceQuery;
pub use causal_chain_tracer::TracerConfig as CctTracerConfig;
pub use causal_chain_tracer::TracerError;
pub use causal_chain_tracer::TracerStats as CctTracerStats;
pub use rule_conflict_resolver::xorshift64 as rcr_xorshift64;
pub use rule_conflict_resolver::ConflictRecord;
pub use rule_conflict_resolver::ConflictType;
pub use rule_conflict_resolver::LogicRule;
pub use rule_conflict_resolver::ResolutionStrategy;
pub use rule_conflict_resolver::ResolverConfig;
pub use rule_conflict_resolver::ResolverError;
pub use rule_conflict_resolver::ResolverStats;
pub use rule_conflict_resolver::RuleConflictResolver;
pub use belief_revision_engine::xorshift64 as bre_xorshift64;
pub use belief_revision_engine::Belief;
pub use belief_revision_engine::BeliefRevisionEngine;
pub use belief_revision_engine::BeliefSet;
pub use belief_revision_engine::ConsistencyCheck;
pub use belief_revision_engine::RetentionFunction;
pub use belief_revision_engine::RevisionConfig;
pub use belief_revision_engine::RevisionError;
pub use belief_revision_engine::RevisionOp;
pub use belief_revision_engine::RevisionStats;
pub use probabilistic_logic_network::AtomType;
pub use probabilistic_logic_network::LinkType;
pub use probabilistic_logic_network::PlnAtom;
pub use probabilistic_logic_network::PlnConfig;
pub use probabilistic_logic_network::PlnError;
pub use probabilistic_logic_network::PlnInferenceResult;
pub use probabilistic_logic_network::PlnInferenceRule;
pub use probabilistic_logic_network::PlnStats;
pub use probabilistic_logic_network::ProbabilisticLogicNetwork;
pub use probabilistic_logic_network::TruthValue;
pub use hypothesis_test_engine::chi2_p_value;
pub use hypothesis_test_engine::normal_cdf;
pub use hypothesis_test_engine::sample_stats;
pub use hypothesis_test_engine::t_cdf_approx;
pub use hypothesis_test_engine::xorshift64;
pub use hypothesis_test_engine::xorshift_normal;
pub use hypothesis_test_engine::EngineConfig as HteEngineConfig;
pub use hypothesis_test_engine::Hypothesis;
pub use hypothesis_test_engine::HypothesisTestEngine;
pub use hypothesis_test_engine::SampleData;
pub use hypothesis_test_engine::TestError;
pub use hypothesis_test_engine::TestResult;
pub use hypothesis_test_engine::TestStatistic;
pub use hypothesis_test_engine::TestStats;
pub use hypothesis_test_engine::TestType;
pub use reinforcement_learning_agent::xorshift64 as rla_xorshift64;
pub use reinforcement_learning_agent::xorshift_f64 as rla_xorshift_f64;
pub use reinforcement_learning_agent::AgentConfig;
pub use reinforcement_learning_agent::AgentPolicy;
pub use reinforcement_learning_agent::AgentStats;
pub use reinforcement_learning_agent::AlgorithmType;
pub use reinforcement_learning_agent::EpisodeStats;
pub use reinforcement_learning_agent::ExperienceReplay;
pub use reinforcement_learning_agent::ReinforcementLearningAgent;
pub use reinforcement_learning_agent::RlAction;
pub use reinforcement_learning_agent::RlAgentError;
pub use reinforcement_learning_agent::RlState;
pub use reinforcement_learning_agent::Transition as RlaTransition;
pub use bayesian_network_inference::bni_xorshift64;
pub use bayesian_network_inference::BayesianNetwork;
pub use bayesian_network_inference::BayesianNetworkInference;
pub use bayesian_network_inference::BniConfig;
pub use bayesian_network_inference::BniError;
pub use bayesian_network_inference::BniStats;
pub use bayesian_network_inference::ConditionalProbabilityTable;
pub use bayesian_network_inference::EliminationOrder;
pub use bayesian_network_inference::Evidence;
pub use bayesian_network_inference::Factor;
pub use bayesian_network_inference::InferenceAlgorithm;
pub use bayesian_network_inference::InferenceQuery;
pub use bayesian_network_inference::QueryResult;
pub use bayesian_network_inference::RandomVariable;
pub use meta_learning_optimizer::AdaptationStep;
pub use meta_learning_optimizer::MetaAlgorithm;
pub use meta_learning_optimizer::MetaError as MloMetaError;
pub use meta_learning_optimizer::MetaLearningOptimizer;
pub use meta_learning_optimizer::MetaStats;
pub use meta_learning_optimizer::MetaTask as MloMetaTask;
pub use meta_learning_optimizer::ModelParams;
pub use meta_learning_optimizer::OptimizerConfig;
pub use meta_learning_optimizer::TaskExample as MloTaskExample;
pub use meta_learning_optimizer::TaskId as MloTaskId;
pub use temporal_knowledge_graph::EdgeId as TkgEdgeId;
pub use temporal_knowledge_graph::NodeId as TkgNodeId;
pub use temporal_knowledge_graph::TemporalKnowledgeGraph;
pub use temporal_knowledge_graph::TkgEdge;
pub use temporal_knowledge_graph::TkgError;
pub use temporal_knowledge_graph::TkgEvent;
pub use temporal_knowledge_graph::TkgGraphStats;
pub use temporal_knowledge_graph::TkgMergePolicy;
pub use temporal_knowledge_graph::TkgNode;
pub use temporal_knowledge_graph::TkgQuery;
pub use temporal_knowledge_graph::TkgQueryResult;
pub use temporal_knowledge_graph::TkgSnapshot;
pub use probabilistic_program_engine::PpeEngineConfig;
pub use probabilistic_program_engine::PpePrior;
pub use probabilistic_program_engine::PpeSampleResult;
pub use probabilistic_program_engine::PpeSamplingMethod;
pub use probabilistic_program_engine::PpeSamplingStats;
pub use probabilistic_program_engine::ProbabilisticProgramEngine;
pub use constraint_propagation_engine::ConstraintPropagationEngine;
pub use constraint_propagation_engine::CpeConstraint;
pub use constraint_propagation_engine::CpeDomain;
pub use constraint_propagation_engine::CpeEngineConfig;
pub use constraint_propagation_engine::CpePropagationResult;
pub use constraint_propagation_engine::CpePropagationStats;
pub use constraint_propagation_engine::CpeVariable;
pub use symbolic_expression_simplifier::SesExpr;
pub use symbolic_expression_simplifier::SesRewriteRule;
pub use symbolic_expression_simplifier::SesSimplifierConfig;
pub use symbolic_expression_simplifier::SesSimplifierStats;
pub use symbolic_expression_simplifier::SymbolicExpressionSimplifier;
pub use decision_tree_learner::DecisionTreeLearner;
pub use decision_tree_learner::DtlCriterion;
pub use decision_tree_learner::DtlLearnerConfig;
pub use decision_tree_learner::DtlLearnerStats;
pub use decision_tree_learner::DtlNode;
pub use decision_tree_learner::DtlPrediction;
pub use decision_tree_learner::DtlSample;
pub use abductive_reasoning_engine::abr_xorshift64;
pub use abductive_reasoning_engine::fnv1a_64 as abr_fnv1a_64;
pub use abductive_reasoning_engine::set_fingerprint as abr_set_fingerprint;
pub use abductive_reasoning_engine::AbductiveReasoningEngine;
pub use abductive_reasoning_engine::AbrAbductiveReasoningEngine;
pub use abductive_reasoning_engine::AbrCostFunction;
pub use abductive_reasoning_engine::AbrEngineConfig;
pub use abductive_reasoning_engine::AbrExplanation;
pub use abductive_reasoning_engine::AbrExplanationRecord;
pub use abductive_reasoning_engine::AbrHypothesis;
pub use abductive_reasoning_engine::AbrReasoningStats;
pub use abductive_reasoning_engine::AbrRule;
pub use abductive_reasoning_engine::AbrTerm;
pub use ensemble_learner::ElBaseModel;
pub use ensemble_learner::ElEnsembleLearner;
pub use ensemble_learner::ElError;
pub use ensemble_learner::ElLearnerConfig;
pub use ensemble_learner::ElLearnerStats;
pub use ensemble_learner::ElMethod;
pub use ensemble_learner::ElPrediction;
pub use ensemble_learner::ElSample;
pub use ensemble_learner::ElTrainingRecord;
pub use ensemble_learner::EnsembleLearner;

Modules§

abductive_reasoning_engine
Abductive Reasoning Engine (ARE)
activation
Activation functions with forward and backward passes for tensor computations.
activation_function
Neural network activation functions with forward pass, derivative, and vectorized operations.
adaptive_optimizer
AdaptiveOptimizer — Adam, AdaGrad, RMSProp, and AdamW optimizers for distributed gradient descent.
allocation_optimizer
Allocation Optimization Utilities
arrow
Apache Arrow integration for zero-copy tensor transport
attention_mechanism
Scaled dot-product attention and multi-head attention for transformer-style models.
audit_log
Inference Audit Log
autograd
Reverse-mode automatic differentiation (autograd) for scalar-output functions over f64 tensor operations.
batch_norm
Batch Normalization layer with running statistics tracking.
bayesian_network_inference
Bayesian Network Inference — variable elimination, belief propagation, and sampling-based inference over discrete Bayesian networks.
bayesian_updater
Bayesian belief updating with conjugate priors, likelihood functions, and posterior inference.
belief_revision_engine
AGM-style Belief Revision Engine
budget_manager
Tensor Budget Manager — computational budget tracking and enforcement per inference session.
cache
Caching support for query results and remote facts
causal_chain_tracer
Causal Chain Tracer — production-quality causal chain tracing for event sequences.
causal_inference
Causal Inference Engine — do-calculus, interventional distributions, and counterfactual reasoning over Gaussian structural equation models.
checkpoint_manager
Checkpoint pruning and validation for gradient checkpoints.
checkpoint_scheduler
TensorCheckpointScheduler — automatic scheduling of tensor checkpoint saves.
checkpoint_v2
Versioned tensor checkpoint manager with delta compression.
checkpointer
TensorCheckpointer — periodic checkpointing of tensor computation state with rollback.
codec_registry
Codec Registry — compression/encoding codec selection and peer negotiation
computation_graph
Computation graph storage and execution
consensus
Federated Learning Round Consensus Tracker
constraint_propagation_engine
Constraint Propagation Engine for IPFRS TensorLogic
constraint_solver
Constraint Satisfaction Problem (CSP) solver with backtracking search, arc consistency (AC-3), and heuristics for variable/value ordering.
data_loader
TensorDataLoader — batch data loading with shuffling and epoch tracking.
datalog
Datalog syntax parser for TensorLogic
decision_tree_learner
DecisionTreeLearner — ID3/C4.5-style decision tree with training, prediction, feature importance, pruning, and rich statistics.
dependency_graph
Tensor Dependency Graph — tracks data dependencies between tensors and rules, enabling incremental recomputation when tensors are updated.
device
Heterogeneous Device Support
differential_privacy
Differential privacy toolkit for IPFRS.
distributed_backward_chainer
Distributed backward-chaining prover for TensorLogic.
distributed_optimizer
Distributed gradient optimizer — coordinates gradient aggregation across multiple distributed training workers with staleness handling, compression-friendly interfaces, and fault-tolerant worker management.
early_stopping
Early stopping monitor for training loops.
ensemble_learner
EnsembleLearner — production-quality ensemble learning system.
epistemic_logic
Epistemic Logic Reasoner — multi-agent epistemic logic over Kripke structures.
event_bus_v2
TensorEventBusV2 — typed in-process event bus for TensorLogic events.
execution_tracer
TensorExecutionTracer — records detailed execution traces of TensorLogic inference operations for debugging, profiling, and replay purposes.
feature_extractor
TensorFeatureExtractor — statistical and structural feature extraction from tensor data.
feed_forward
Feedforward network layer for transformer blocks.
ffi_profiler
FFI Overhead Profiling
flow_controller
Tensor flow controller — manages backpressure, rate limiting, and priority-based admission for tensor data flowing through a processing pipeline.
fuzzy_logic
Fuzzy Logic Engine for approximate reasoning.
fuzzy_logic_engine
Full-featured Fuzzy Logic Engine with Mamdani inference and multiple defuzzification strategies.
gpu
GPU Execution Backend (Stub for Future Integration)
grad_accumulator
Gradient accumulation across mini-batches before optimizer step.
gradient
Gradient storage and management for federated learning
gradient_accumulator
Gradient accumulator for federated learning rounds.
gradient_checkpointer
GradientCheckpointer — gradient accumulation, checkpointing, and replay for distributed training with fault tolerance.
gradient_clipper
Gradient clipping strategies for distributed tensor learning.
gradient_noise
Gradient noise injection for training regularization.
gradient_sparsify
Gradient sparsification and delta encoding for federated learning.
graph_neural_network
Graph Neural Network (GNN) with message-passing, edge weighting, and multi-layer propagation.
graph_partitioner
Tensor computation graph partitioner for distributed execution.
hyperparameter_tuner
Hyperparameter Tuner — Bayesian optimization and random/grid search.
hypothesis_test_engine
Statistical Hypothesis Testing Engine for Logical Assertions
inference_cache
Inference Cache with Invalidation
inference_scheduler
TensorInferenceScheduler — deadline-aware priority scheduling for TensorLogic inference jobs.
inference_trace
Inference trace recorder for debugging and performance analysis.
ipld_codec
IPLD codec for TensorLogic IR
ipld_path
IPLD path resolution for TensorLogic structures
ir
TensorLogic IR types
kb_federation
Knowledge Base Federation
kernel_registry
TensorKernelRegistry — a registry of computational kernels (named tensor operations with metadata), enabling dynamic kernel lookup, versioning, and capability-based selection.
kg_traversal
Knowledge Graph Traversal for TensorLogic distributed reasoning.
loss_function
TensorLossFunction — common loss functions for tensor computations.
loss_scaler
LossScaler – dynamic loss scaling for mixed-precision training.
lr_scheduler
TensorLRScheduler – learning rate scheduling strategies for tensor optimization loops.
markov_decision_process
Markov Decision Process (MDP) solver.
memory_layout
Tensor memory layout management for multi-dimensional arrays.
memory_pool
Tensor Memory Pool
memory_profiler
Memory profiling utilities for tracking allocations and memory usage.
memory_tracker
Inference Memory Tracker
meta_learner
MetaLearner — MAML-inspired meta-learning system.
meta_learning_optimizer
MetaLearningOptimizer — production-quality meta-learning (learning to learn) optimization.
ml_feature_extractor
ML preprocessing FeatureExtractor — composable feature engineering pipeline.
model_ensemble
ModelEnsemble — Multi-model ensemble aggregator for distributed inference.
model_pruner
Model weight pruning with magnitude, structured, and gradual scheduling strategies.
multi_hop
Multi-hop rule resolution with loop detection for the IPFRS distributed logic engine.
neural_arch_search
Neural Architecture Search (NAS) — random and evolutionary search for optimal network structures.
neural_symbolic
Neural-Symbolic Integrator — bridges continuous embedding representations with symbolic logical rule reasoning for hybrid inference.
online_learner
Online / incremental learning algorithms for streaming data.
op_dispatcher
TensorOpDispatcher — routes tensor operations to registered backends (CPU / GPU / Remote / Simulated) based on op type and backend availability, with priority-ordered fallback chains and per-backend statistics.
op_fusion
Tensor operation fusion — detects and fuses sequences of tensor operations into optimized compound operations, reducing memory bandwidth and computation overhead.
op_scheduler
Tensor operation scheduler with priority, dependency tracking, and resource accounting.
optimization_history
TensorOptimizationHistory — records and analyzes optimization steps (loss/gradient values) to detect convergence, track best results, and guide adaptive learning rate schedules.
optimizer
Query optimization for TensorLogic
privacy_budget
Differential privacy budget accounting for federated learning.
probabilistic_logic_network
Probabilistic Logic Network (PLN) — uncertain reasoning combining probability theory with logic.
probabilistic_program_engine
Probabilistic Program Engine — Bayesian reasoning and posterior sampling.
profiler
TensorProfiler — operation profiling for tensor computations.
proof_cache
Proof Caching Layer
proof_explanation
Automatic Proof Explanation
proof_serializer
Proof Serializer
proof_storage
Proof fragment storage as IPLD
proof_tree
Distributed proof tree construction for TensorLogic backward chaining.
proof_tree_export
Proof tree exporter — renders verified proof trees to multiple output formats.
proof_tree_streaming
Distributed proof tree streaming via incremental update events.
proof_verifier
Proof Verifier
provenance
Provenance tracking for ML models
provenance_tracker
Tensor Provenance Tracker
pytorch_checkpoint
PyTorch model checkpoint support for ipfrs-tensorlogic.
quantization
Model Quantization Support
quantizer
TensorQuantizer — symmetric and asymmetric quantization for tensor values.
query_optimizer
TensorQueryOptimizer — Rewrites TensorLogic query plans before execution.
reasoning
Distributed reasoning and inference engine
recursive_reasoning
Recursive Query Support with Tabling
regularizer
L1/L2/ElasticNet regularization for tensor parameters.
reinforcement_learner
Reinforcement learning agents — Q-learning and SARSA for discrete action spaces.
reinforcement_learning_agent
Tabular reinforcement learning agent with multiple algorithms.
remote_reasoning
Remote Knowledge Retrieval and Distributed Reasoning
rule_conflict_resolver
RuleConflictResolver — production-quality logic rule conflict detection and resolution.
rule_conflict_v2
Extended Rule Conflict Resolution V2
rule_dependency
Rule Dependency Graph
rule_index
Multi-dimensional index over TensorLogic rules.
rule_migrator
Rule version migration for TensorLogic rule sets.
rule_profiler
Rule Execution Profiler — invocation counts, latencies, hit rates, and hotspot detection.
rule_validator
TensorLogic rule validator.
rule_versioning
Rule set versioning and conflict resolution for distributed knowledge federation.
safetensors_support
Safetensors file format support
session_manager
Distributed Inference Session Manager
session_replay
Session Replay Engine — records and replays inference sessions for debugging, regression testing, and audit purposes.
sgd_optimizer
SGD Optimizer variants for tensor parameter optimization.
shape_inference
Static shape inference for tensor operation graphs.
shared_memory
Shared memory support for zero-copy IPC
slice_manager
TensorSliceManager — named tensor slice management with copy-on-write semantics, bounds checking, and overlap detection.
slice_view
TensorSliceView — zero-copy logical views into tensor data via offset+stride descriptors, supporting slicing, broadcasting, and element access without data duplication.
state_snapshot
TensorStateSnapshot — captures and restores complete TensorLogic runtime state for migration, debugging, and distributed coordination purposes.
storage
Storage for TensorLogic IR
symbolic_expression_simplifier
Symbolic Expression Simplifier — multi-pass rewriting engine for symbolic math expressions.
symbolic_neural_optimizer
SymbolicNeuralOptimizer — hybrid optimizer combining symbolic rule-based parameter updates with gradient-based neural optimization.
temporal_knowledge_graph
Temporal Knowledge Graph — tracks how facts and relationships evolve over time.
temporal_pattern_matcher
Temporal Pattern Matcher — NFA-based temporal sequence pattern matching.
temporal_reasoning
Temporal Reasoning Engine — temporal logic for time-based constraints, intervals, and event ordering.
tensor_arena
Arena allocator for inference pipeline tensor memory management.
tensor_checksum
Tensor Checksum Engine
tensor_diff
TensorDiffEngine — structural and numeric diff between tensor snapshots.
tensor_gc
Garbage collector for unreachable tensor allocations.
tensor_pool
Slab-based Reusable Buffer Pool for Arrow IPC Zero-Copy Tensor Operations
tensor_quantizer
TensorQuantizer — Multi-precision tensor quantization for model compression.
term_index
Inverted index over TensorLogic terms for fast predicate/constant/variable lookup.
utils
Utility functions for common TensorLogic operations
version_control
Model version control system for ML models
versioned_cache
Versioned Inference Cache with Atomic KB Invalidation
visualization
Visualization utilities for computation graphs and proofs.
weight_initializer
Weight initialization strategies for tensor operations.

Macros§

profile_ffi
Profile an FFI function call