This commit is contained in:
gaxler
2021-01-26 00:04:15 -08:00
parent 139bbae456
commit 0df797cbae
+1 -7
View File
@@ -24,13 +24,7 @@ enum LabelDefinition<T> {
pub fn make_one_hot<T: RealNumber>(label_idx: usize, num_labels: usize) -> Vec<T> {
let (pos, neg) = (T::from_f64(1f64).unwrap(), T::from_f64(0f64).unwrap());
(0..num_labels)
.map(|idx| {
if idx == label_idx {
pos
} else {
neg
}
})
.map(|idx| if idx == label_idx { pos } else { neg })
.collect()
}