Prints a single image and label to screen.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rk), | intent(in) | :: | images(:,:) | |||
| real(kind=rk), | intent(in) | :: | labels(:) | |||
| integer(kind=ik), | intent(in) | :: | n |
subroutine print_image(images, labels, n)
!! Prints a single image and label to screen.
real(rk), intent(in) :: images(:,:), labels(:)
integer(ik), intent(in) :: n
real(rk) :: image(28, 28)
character(len=1) :: char_image(28, 28)
integer(ik) i, j
image = reshape(images(:,n), [28, 28])
char_image = '.'
where (image > 0) char_image = '#'
print *, labels(n)
do j = 1, 28
print *, char_image(:,j)
end do
end subroutine print_image