Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function compute_mlr_a(w, b, x, n, m)
- implicit none
- integer, intent(in) :: n,m
- real(kind=8), dimension(n), intent(in) :: x
- real(kind=8), dimension(m,n), intent(in) :: w
- real(kind=8), dimension(m - 1), intent(in) :: b
- real(kind=8), dimension(m) :: z
- real(kind=8), dimension(m) :: compute_mlr_a
- real(kind=8) :: denom
- ! Compute z
- z(1) = 0
- ! Add weight component
- z(:) = z(:) + matmul(w,x)
- ! Add bias
- z(2:) = z(2:) + b(:)
- ! Compute a
- denom = sum(exp(z))
- compute_mlr_a = compute_mlr_a / denom
- end function compute_mlr_a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement