diff --git a/crates/ml-core/src/cuda_autograd/gpu_tensor.rs b/crates/ml-core/src/cuda_autograd/gpu_tensor.rs index 7df51166a..42f983f74 100644 --- a/crates/ml-core/src/cuda_autograd/gpu_tensor.rs +++ b/crates/ml-core/src/cuda_autograd/gpu_tensor.rs @@ -289,62 +289,7 @@ impl GpuTensor { } // ----------------------------------------------------------------------- - // Legacy `_candle` suffix aliases for migration compatibility. - // These forward to the canonical methods above. - // ----------------------------------------------------------------------- - - /// Alias for `randn()` — legacy name from candle migration. - pub fn randn_candle(shape: &[usize], std_dev: f32, stream: &Arc) -> Result { - Self::randn(shape, std_dev, stream) - } - - /// Alias for `zeros()` — accepts various shape types for candle compat. - pub fn zeros_candle(shape: &[usize], stream: &Arc) -> Result { - Self::zeros(shape, stream) - } - - /// Alias for `scalar()` — accepts `(value, ignored)` for candle migration compat. - /// The second argument is ignored (was candle Device). - pub fn scalar_candle(_value: V, _device: D) -> Result { - // Without a stream we cannot allocate. Return a CPU-side error. - // Callers should migrate to scalar() with explicit stream. - Err(MLError::ModelError( - "scalar_candle: migrate to scalar() with explicit Arc".to_string() - )) - } - - /// Alias for `eye()` — accepts `(n, ignored_dtype, ignored_device)` for candle compat. - pub fn eye_candle(_n: usize, _dtype: D1, _device: D2) -> Result { - Err(MLError::ModelError( - "eye_candle: migrate to eye() with explicit Arc".to_string() - )) - } - - /// Alias for `from_host()` — legacy name from candle migration. - pub fn from_vec_candle>, D>(_data: Vec, _shape: S, _device: D) -> Result { - Err(MLError::ModelError( - "from_vec_candle: migrate to from_host() with explicit Arc".to_string() - )) - } - - /// Alias for `from_host()` — legacy name from candle migration. - pub fn from_slice_candle>>(data: &[f32], shape: S, stream: &Arc) -> Result { - Self::from_host(data, shape.into(), stream) - } - - /// Alias for `stack()` — legacy name from candle migration. - pub fn stack_candle(_tensors: &[Self], _dim: usize) -> Result { - Err(MLError::ModelError( - "stack_candle: use stack() with explicit stream instead".to_string() - )) - } - - /// Alias for `cat()` — legacy name from candle migration. - pub fn cat_candle(_tensors: &[&Self], _dim: usize) -> Result { - Err(MLError::ModelError( - "cat_candle: use cat() with explicit stream instead".to_string() - )) - } + // _candle suffix aliases removed — migration complete, zero callers remain. // ----------------------------------------------------------------------- // Tensor algebra: element-wise ops, reductions, slicing. diff --git a/crates/ml-core/src/gradient_accumulation.rs b/crates/ml-core/src/gradient_accumulation.rs deleted file mode 100644 index 9c5e8a2bd..000000000 --- a/crates/ml-core/src/gradient_accumulation.rs +++ /dev/null @@ -1,12 +0,0 @@ -//! Gradient accumulation utilities (legacy shim). -//! -//! The Candle-based gradient accumulation functions (which operated on -//! `candle_core::backprop::GradStore` and `candle_core::Var`) have been removed. -//! -//! GPU gradient accumulation is now handled by `cuda_autograd::GpuAdamW` via -//! `BTreeMap` gradient maps. For accumulation across -//! micro-batches, callers should accumulate `GpuTensor` gradients directly -//! using element-wise addition on GPU. -//! -//! This module is kept as an empty placeholder so that `pub mod gradient_accumulation` -//! in `lib.rs` compiles. diff --git a/crates/ml-core/src/gradient_utils.rs b/crates/ml-core/src/gradient_utils.rs deleted file mode 100644 index 78ecf262c..000000000 --- a/crates/ml-core/src/gradient_utils.rs +++ /dev/null @@ -1,12 +0,0 @@ -//! Gradient utilities (legacy shim). -//! -//! The Candle-based gradient clipping and NaN detection functions have been -//! removed. GPU gradient operations are now handled by: -//! -//! - `cuda_autograd::GpuAdamW` — built-in gradient norm clipping per step. -//! - Loss functions in `cuda_autograd::LossKernels` — produce gradient tensors -//! directly, no separate `GradStore`. -//! -//! This module is kept as an empty placeholder so that `pub mod gradient_utils` -//! in `lib.rs` compiles. Downstream crates should migrate to the cuda_autograd -//! equivalents. diff --git a/crates/ml-core/src/lib.rs b/crates/ml-core/src/lib.rs index 8113a63aa..0b0a3c7eb 100644 --- a/crates/ml-core/src/lib.rs +++ b/crates/ml-core/src/lib.rs @@ -128,9 +128,6 @@ pub mod model; pub mod traits; // ========== COMPUTE PRIMITIVES (moved from ml in task 5b) ========== -pub mod optimizers; -pub mod gradient_accumulation; -pub mod gradient_utils; pub mod tensor_ops; pub mod gpu; pub mod safety; diff --git a/crates/ml-core/src/optimizers/adam.rs b/crates/ml-core/src/optimizers/adam.rs deleted file mode 100644 index 71fa3fd87..000000000 --- a/crates/ml-core/src/optimizers/adam.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! Adam optimizer (legacy shim). -//! -//! The Candle-based `Adam` wrapper has been removed. All GPU optimization -//! now uses `cuda_autograd::GpuAdamW` which runs entirely on GPU via CUDA -//! kernels. This module is kept as an empty placeholder so that -//! `pub mod adam` in `optimizers/mod.rs` does not fail. -//! -//! Downstream crates should migrate to `ml_core::cuda_autograd::GpuAdamW`. diff --git a/crates/ml-core/src/optimizers/mod.rs b/crates/ml-core/src/optimizers/mod.rs deleted file mode 100644 index e918bfb27..000000000 --- a/crates/ml-core/src/optimizers/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod adam; - -// Note: The Candle-based `Adam` struct has been removed. -// GPU optimization now uses `crate::cuda_autograd::GpuAdamW`. diff --git a/crates/ml/src/lib.rs b/crates/ml/src/lib.rs index b3114aa85..c30aa97d4 100644 --- a/crates/ml/src/lib.rs +++ b/crates/ml/src/lib.rs @@ -178,9 +178,6 @@ pub use ml_core::model; pub use ml_core::traits; // Compute primitives re-exported from ml-core (task 5b) -pub use ml_core::optimizers; -pub use ml_core::gradient_accumulation; -pub use ml_core::gradient_utils; pub use ml_core::tensor_ops; pub use ml_core::gpu; pub use ml_core::safety;