Skip to content

Commit

Permalink
Enforce Send bounds on KernelDense and KernelSparse traits
Browse files Browse the repository at this point in the history
This allows loading an SVM model on one thread, move it to another thread and then use it there.
  • Loading branch information
seijikun authored Aug 25, 2024
1 parent 447b035 commit 8f37157
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/svm/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub use self::{linear::*, poly::*, rbf::*, sigmoid::*};
#[doc(hidden)]
pub trait KernelDense
where
Self: Sync,
Self: Send + Sync,
{
fn compute(&self, vectors: &MatrixD<f32s, Rows>, feature: &VectorD<f32s>, output: &mut [f64]);
}
Expand All @@ -24,7 +24,7 @@ where
#[doc(hidden)]
pub trait KernelSparse
where
Self: Sync,
Self: Send + Sync,
{
fn compute(&self, vectors: &SparseMatrix<f32>, feature: &SparseVector<f32>, output: &mut [f64]);
}

0 comments on commit 8f37157

Please sign in to comment.