Guest User

Untitled

a guest
Apr 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. extern crate num;
  2.  
  3. fn sigmoidActivation<'a, T: 'a>(inputs: &'a [T]) -> T
  4. where
  5. T: ::std::marker::Copy + num::traits::Float + std::ops::Add<T>,
  6. f32: std::ops::Add<T>,
  7. T: std::iter::Sum<&'a T>,
  8. {
  9. (inputs.iter().sum::<T>().exp()).recip()
  10. }
  11.  
  12. fn main() {
  13. let vector: Vec<f32> = vec![0.0, 0.1];
  14. sigmoidActivation(&vector);
  15. }
Add Comment
Please, Sign In to add comment