style: cargo fmt --workspace (whitespace/wrapping only, no semantic change)

Whole-workspace rustfmt pass picked up while iterating on Mamba GPU
backward work. Verified formatting-only via diff sampling; no logic
changed.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
osobh
2026-08-10 07:09:36 -07:00
co-authored by Claude Sonnet 5
parent ad6405663f
commit 4aaa36a57a
305 changed files with 25537 additions and 18337 deletions
@@ -287,12 +287,27 @@ impl DecisionTreeClassifier {
use pyo3::IntoPyObjectExt;
Python::with_gil(|py| {
let mut params = HashMap::new();
params.insert("criterion".to_string(), self.criterion.clone().into_py_any(py)?);
params.insert(
"criterion".to_string(),
self.criterion.clone().into_py_any(py)?,
);
params.insert("max_depth".to_string(), self.max_depth.into_py_any(py)?);
params.insert("min_samples_split".to_string(), self.min_samples_split.into_py_any(py)?);
params.insert("min_samples_leaf".to_string(), self.min_samples_leaf.into_py_any(py)?);
params.insert("random_state".to_string(), self.random_state.into_py_any(py)?);
params.insert("device".to_string(), self.device.to_string().into_py_any(py)?);
params.insert(
"min_samples_split".to_string(),
self.min_samples_split.into_py_any(py)?,
);
params.insert(
"min_samples_leaf".to_string(),
self.min_samples_leaf.into_py_any(py)?,
);
params.insert(
"random_state".to_string(),
self.random_state.into_py_any(py)?,
);
params.insert(
"device".to_string(),
self.device.to_string().into_py_any(py)?,
);
Ok(params)
})
}
@@ -371,11 +386,7 @@ impl DecisionTreeClassifier {
let importances = Array1::from_iter(importances_data.iter().map(|&x| x as f64));
Python::with_gil(|py| {
Ok(Some(
ArrayConverter::from_array1(py, importances)?.unbind(),
))
})
Python::with_gil(|py| Ok(Some(ArrayConverter::from_array1(py, importances)?.unbind())))
}
#[getter]
@@ -197,9 +197,9 @@ impl KMeans {
self.fit(x)?;
match &self.labels_ {
Some(labels) => Python::with_gil(|py| {
Ok(ArrayConverter::from_array1(py, labels.clone())?.unbind())
}),
Some(labels) => {
Python::with_gil(|py| Ok(ArrayConverter::from_array1(py, labels.clone())?.unbind()))
}
None => Err(PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(
"fit_predict failed: no labels available",
)),
@@ -235,9 +235,15 @@ impl KMeans {
Python::with_gil(|py| {
let mut params = HashMap::new();
params.insert("n_clusters".to_string(), self.n_clusters.into_py_any(py)?);
params.insert("random_state".to_string(), self.random_state.into_py_any(py)?);
params.insert(
"random_state".to_string(),
self.random_state.into_py_any(py)?,
);
params.insert("max_iter".to_string(), self.max_iter.into_py_any(py)?);
params.insert("device".to_string(), self.device.to_string().into_py_any(py)?);
params.insert(
"device".to_string(),
self.device.to_string().into_py_any(py)?,
);
Ok(params)
})
}
@@ -27,7 +27,11 @@ pub struct GridSearchCV {
impl GridSearchCV {
#[new]
#[pyo3(signature = (estimator, param_grid, cv=5))]
fn new<'py>(estimator: PyObject, param_grid: &Bound<'py, PyDict>, cv: Option<usize>) -> PyResult<Self> {
fn new<'py>(
estimator: PyObject,
param_grid: &Bound<'py, PyDict>,
cv: Option<usize>,
) -> PyResult<Self> {
// Convert param_grid from PyDict to HashMap (simplified)
let param_grid_map = HashMap::new(); // Placeholder
@@ -56,7 +60,9 @@ impl GridSearchCV {
Python::with_gil(|py| {
let x_view = ArrayConverter::to_array_view2(&x).map_err(|e| PyErr::from(e))?;
let dummy_preds = Array1::<f64>::zeros(x_view.shape()[0]);
Ok(ArrayConverter::from_array1(py, dummy_preds)?.into_any().unbind())
Ok(ArrayConverter::from_array1(py, dummy_preds)?
.into_any()
.unbind())
})
}
@@ -161,16 +167,21 @@ pub fn train_test_split(
let y_train_1d = Array1::from_vec(y_train.iter().copied().collect());
let y_test_1d = Array1::from_vec(y_test.iter().copied().collect());
let x_train_py = ArrayConverter::from_array2(py, x_train_2d)?.into_any().unbind();
let x_test_py = ArrayConverter::from_array2(py, x_test_2d)?.into_any().unbind();
let y_train_py = ArrayConverter::from_array1(py, y_train_1d)?.into_any().unbind();
let y_test_py = ArrayConverter::from_array1(py, y_test_1d)?.into_any().unbind();
let x_train_py = ArrayConverter::from_array2(py, x_train_2d)?
.into_any()
.unbind();
let x_test_py = ArrayConverter::from_array2(py, x_test_2d)?
.into_any()
.unbind();
let y_train_py = ArrayConverter::from_array1(py, y_train_1d)?
.into_any()
.unbind();
let y_test_py = ArrayConverter::from_array1(py, y_test_1d)?
.into_any()
.unbind();
// Return tuple
let result = PyTuple::new(
py,
&[x_train_py, x_test_py, y_train_py, y_test_py],
)?;
let result = PyTuple::new(py, &[x_train_py, x_test_py, y_train_py, y_test_py])?;
Ok(result.into_any().unbind())
}
@@ -3,7 +3,7 @@ Simplified sklearn-compatible regressor wrappers
*/
use numpy::ndarray::Array1;
use numpy::{PyArray1, PyReadonlyArrayDyn, PyArrayMethods};
use numpy::{PyArray1, PyArrayMethods, PyReadonlyArrayDyn};
use pyo3::prelude::*;
use std::collections::HashMap;
@@ -117,7 +117,10 @@ impl LinearRegression {
"fit_intercept".to_string(),
self.fit_intercept.into_py_any(py)?,
);
params.insert("device".to_string(), self.device.to_string().into_py_any(py)?);
params.insert(
"device".to_string(),
self.device.to_string().into_py_any(py)?,
);
Ok(params)
})
}