Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate num;
- fn sigmoidActivation<'a, T: 'a>(inputs: Vec<T>) -> T
- where
- T: ::std::marker::Copy + num::traits::Float + std::ops::Add<T>,
- f32: std::ops::Add<T>,
- T: std::iter::Sum<&'a T>,
- {
- (inputs.iter().sum::<T>().exp()).recip()
- }
- fn main() {
- let vector: Vec<f32> = vec![0.0, 0.1];
- sigmoidActivation(vector);
- }
Add Comment
Please, Sign In to add comment