label_digits Function

public pure function label_digits(labels) result(res)

Converts an array of MNIST labels into a form that can be input to the network_type instance.

Arguments

Type IntentOptional AttributesName
real(kind=rk), intent(in) :: labels(:)

Return Value real(kind=rk) (10,size(labels))


Contents

Source Code


Source Code

  pure function label_digits(labels) result(res)
    !! Converts an array of MNIST labels into a form
    !! that can be input to the network_type instance.
    real(rk), intent(in) :: labels(:)
    real(rk) :: res(10, size(labels))
    integer(ik) :: i
    do i = 1, size(labels)
      res(:,i) = digits(labels(i))
    end do
  end function label_digits