Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. function compute_mlr_a(w, b, x, n, m)
  2. implicit none
  3. integer, intent(in) :: n,m
  4.  
  5. real(kind=8), dimension(n), intent(in) :: x
  6. real(kind=8), dimension(m,n), intent(in) :: w
  7. real(kind=8), dimension(m - 1), intent(in) :: b
  8. real(kind=8), dimension(m) :: z
  9. real(kind=8), dimension(m) :: compute_mlr_a
  10. real(kind=8) :: denom
  11.  
  12. ! Compute z
  13. z(1) = 0
  14. ! Add weight component
  15. z(:) = z(:) + matmul(w,x)
  16. ! Add bias
  17. z(2:) = z(2:) + b(:)
  18.  
  19. ! Compute a
  20. denom = sum(exp(z))
  21. compute_mlr_a = compute_mlr_a / denom
  22. end function compute_mlr_a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement