Skip to content

Commit 291c118

Browse files
kornelskijjhbw
authored andcommitted
Cloneable model
1 parent 82baf6b commit 291c118

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

src/classifier/lab_boosted_classifier.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
use super::Score;
2020
use crate::feat::LabBoostedFeatureMap;
2121

22+
#[derive(Clone)]
2223
pub struct LabBoostedClassifier {
2324
features: Vec<(i32, i32)>,
2425
base_classifiers: Vec<BaseClassifier>,
2526
}
2627

28+
#[derive(Clone)]
2729
struct BaseClassifier {
2830
weights: Vec<f32>,
2931
thresh: f32,

src/classifier/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ impl Score {
5454
}
5555
}
5656

57+
#[derive(Clone)]
5758
pub enum Classifier {
5859
SurfMlp(SurfMlpClassifier),
5960
LabBoosted(LabBoostedClassifier),

src/classifier/surf_mlp_classifier.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ impl SurfMlpBuffers {
6868
}
6969
}
7070

71+
#[derive(Clone)]
7172
pub struct SurfMlpClassifier {
7273
feature_ids: Vec<i32>,
7374
thresh: f32,
@@ -156,6 +157,7 @@ impl SurfMlpClassifier {
156157
}
157158
}
158159

160+
#[derive(Clone)]
159161
struct Layer {
160162
input_dim: usize,
161163
output_dim: usize,

src/model/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use std::io;
2424
use crate::classifier::{Classifier, ClassifierKind, LabBoostedClassifier, SurfMlpClassifier};
2525
use byteorder::{LittleEndian, ReadBytesExt};
2626

27+
#[derive(Clone)]
2728
pub struct Model {
2829
classifiers: Vec<Classifier>,
2930
wnd_src_id: Vec<Vec<i32>>,

0 commit comments

Comments
 (0)