Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/mod_layer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ end function constructor

pure type(array1d) function array1d_constructor(length) result(a)
! Overloads the default type constructor.
integer, intent(in) :: length
integer(ik), intent(in) :: length
allocate(a % array(length))
a % array = 0
end function array1d_constructor

pure type(array2d) function array2d_constructor(dims) result(a)
! Overloads the default type constructor.
integer, intent(in) :: dims(2)
integer(ik), intent(in) :: dims(2)
allocate(a % array(dims(1), dims(2)))
a % array = 0
end function array2d_constructor
Expand All @@ -76,7 +76,7 @@ pure subroutine db_init(db, dims)
! Initialises biases structure.
type(array1d), allocatable, intent(in out) :: db(:)
integer(ik), intent(in) :: dims(:)
integer :: n, nm
integer(ik) :: n, nm
nm = size(dims)
allocate(db(nm))
do n = 1, nm - 1
Expand All @@ -89,7 +89,7 @@ pure subroutine dw_init(dw, dims)
! Initialises weights structure.
type(array2d), allocatable, intent(in out) :: dw(:)
integer(ik), intent(in) :: dims(:)
integer :: n, nm
integer(ik) :: n, nm
nm = size(dims)
allocate(dw(nm))
do n = 1, nm - 1
Expand Down
6 changes: 3 additions & 3 deletions src/mod_network.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module mod_network
type :: network_type

type(layer_type), allocatable :: layers(:)
integer, allocatable :: dims(:)
integer(ik), allocatable :: dims(:)

contains

Expand Down Expand Up @@ -75,7 +75,7 @@ pure real(rk) function accuracy(self, x, y)
good = good + 1
end if
end do
accuracy = real(good) / size(x, dim=2)
accuracy = real(good, kind=rk) / size(x, dim=2)
end function accuracy


Expand All @@ -86,7 +86,7 @@ pure subroutine backprop(self, y, dw, db)
real(rk), intent(in) :: y(:)
type(array2d), allocatable, intent(out) :: dw(:)
type(array1d), allocatable, intent(out) :: db(:)
integer :: n, nm
integer(ik) :: n, nm

associate(dims => self % dims, layers => self % layers)

Expand Down