Crate ghost_flow

Crate ghost_flow 

Source
Expand description

§GhostFlow - Complete Machine Learning Framework in Rust

GhostFlow is a production-ready machine learning framework built entirely in Rust, designed to rival PyTorch and TensorFlow in both performance and ease of use.

§Features

  • Tensor Operations: Multi-dimensional arrays with SIMD optimization
  • Automatic Differentiation: Full autograd engine with computational graph
  • Neural Networks: CNN, RNN, LSTM, GRU, Transformer, Attention
  • 50+ ML Algorithms: Decision trees, random forests, SVM, clustering, and more
  • GPU Acceleration: Hand-optimized CUDA kernels (optional)
  • Production Ready: Zero warnings, comprehensive tests, full documentation

§Quick Start

use ghostflow::prelude::*;

// Create tensors
let x = Tensor::randn(&[32, 784]);
let y = Tensor::randn(&[32, 10]);

// Tensor operations
let z = x.matmul(&y.transpose(0, 1).unwrap()).unwrap();

§Installation

Add to your Cargo.toml:

[dependencies]
ghostflow = "0.1"

With GPU support:

[dependencies]
ghostflow = { version = "0.1", features = ["cuda"] }

§Modules

  • core - Core tensor operations and data structures
  • nn - Neural network layers and building blocks
  • ml - Classical machine learning algorithms
  • autograd - Automatic differentiation
  • optim - Optimizers (SGD, Adam, AdamW)
  • data - Data loading and preprocessing utilities
  • [cuda] - GPU acceleration (optional)

Re-exports§

pub use ghostflow_core as core;
pub use ghostflow_nn as nn;
pub use ghostflow_ml as ml;
pub use ghostflow_autograd as autograd;
pub use ghostflow_optim as optim;
pub use ghostflow_data as data;

Modules§

device
Device abstraction for CPU/GPU execution
dtype
Data types supported by GhostFlow tensors
error
Error types for GhostFlow
fusion
Operation Fusion Engine
jit
JIT Compiler for GPU Kernels
layout
Memory Layout Optimizer
ops
Tensor operations
prelude
Prelude module for convenient imports
serialize
Model serialization and deserialization
shape
Shape and stride handling for tensors
storage
Storage backend for tensor data
tensor
Core Tensor type - the foundation of GhostFlow
tensor_ops
Tensor operations trait extensions

Structs§

CompiledKernel
JIT-compiled kernel
ComputeGraph
Compute graph for operation fusion
Cpu
CPU device - default compute device
DeviceInfo
Device capabilities
FusionEngine
Operation fusion engine
JitCompiler
JIT compiler that generates and caches optimized kernels
LayoutOptimizer
Layout optimizer
Shape
Shape of a tensor - dimensions along each axis
Storage
Raw storage for tensor data Separate from Tensor to enable zero-copy views
Strides
Strides for memory layout - bytes to skip for each dimension
Tensor
The core Tensor type

Enums§

DType
Supported data types for tensor elements
FusionPattern
Fusion patterns that can be optimized
GhostError
Main error type for GhostFlow operations
MemoryLayout
Memory layout formats

Traits§

Device
Trait for compute devices (CPU, CUDA, etc.)
Serializable
Trait for models that can be serialized

Functions§

load_state_dict
Load a state dictionary from a file
save_state_dict
Save a state dictionary to a file

Type Aliases§

Result
Result type alias for GhostFlow operations
StateDict
State dictionary - maps parameter names to tensors