Skip to content

Commit

Permalink
chore: fix fypp diff
Browse files Browse the repository at this point in the history
  • Loading branch information
TomMelt committed Nov 18, 2024
1 parent f1c4d51 commit b22bb54
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/fypp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:

- name: Check ftorch.fypp matches ftorch.f90
run: |
fypp src/ftorch.fypp src/temp.f90_temp
if ! diff -q src/ftorch.f90 src/temp.f90_temp; then
echo "Error: The code in ftorch.f90 does not match that expected from ftorch.fypp."
fypp src/ftorch.fypp src/temp.F90_temp
if ! diff -q src/ftorch.F90 src/temp.F90_temp; then
echo "Error: The code in ftorch.F90 does not match that expected from ftorch.fypp."
echo "Please re-run fypp on ftorch.fypp to ensure consistency and re-commit."
exit 1
else
Expand Down
26 changes: 13 additions & 13 deletions src/ftorch.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module ftorch

implicit none

integer, parameter :: FT_INT = int32 ! set integer size for FTorch library
integer, parameter :: FT_INT = int64 ! set integer size for FTorch library

!> Type for holding a torch neural net (nn.Module).
type torch_model
Expand Down Expand Up @@ -757,7 +757,7 @@ subroutine torch_tensor_from_array_int8_5d(tensor, data_in, layout, &

! inputs
integer(kind=int8), intent(in), target :: data_in(:,:,:,:,:) !! Input data that tensor will point at
integer, intent(in) :: layout(5) !! Control order of indices
integer(FT_INT), intent(in) :: layout(5) !! Control order of indices
integer(c_int), intent(in) :: c_device_type !! Device type the tensor will live on (`torch_kCPU` or `torch_kCUDA`)
integer(c_int), optional, intent(in) :: device_index !! device index to use for `torch_kCUDA` case
logical, optional, intent(in) :: requires_grad !! Whether gradients need to be computed for the created tensor
Expand All @@ -767,7 +767,7 @@ subroutine torch_tensor_from_array_int8_5d(tensor, data_in, layout, &
integer(c_int), parameter :: c_dtype = torch_kInt8 !! Data type
integer(c_int64_t) :: strides(5) !! Strides for accessing data
integer(c_int), parameter :: ndims = 5 !! Number of dimension of input data
integer :: i
integer(FT_INT) :: i
integer(c_int) :: device_index_value
logical :: requires_grad_value !! Whether gradients need to be computed for the created tensor

Expand Down Expand Up @@ -1027,7 +1027,7 @@ subroutine torch_tensor_from_array_int16_5d(tensor, data_in, layout, &

! inputs
integer(kind=int16), intent(in), target :: data_in(:,:,:,:,:) !! Input data that tensor will point at
integer, intent(in) :: layout(5) !! Control order of indices
integer(FT_INT), intent(in) :: layout(5) !! Control order of indices
integer(c_int), intent(in) :: c_device_type !! Device type the tensor will live on (`torch_kCPU` or `torch_kCUDA`)
integer(c_int), optional, intent(in) :: device_index !! device index to use for `torch_kCUDA` case
logical, optional, intent(in) :: requires_grad !! Whether gradients need to be computed for the created tensor
Expand All @@ -1037,7 +1037,7 @@ subroutine torch_tensor_from_array_int16_5d(tensor, data_in, layout, &
integer(c_int), parameter :: c_dtype = torch_kInt16 !! Data type
integer(c_int64_t) :: strides(5) !! Strides for accessing data
integer(c_int), parameter :: ndims = 5 !! Number of dimension of input data
integer :: i
integer(FT_INT) :: i
integer(c_int) :: device_index_value
logical :: requires_grad_value !! Whether gradients need to be computed for the created tensor

Expand Down Expand Up @@ -1297,7 +1297,7 @@ subroutine torch_tensor_from_array_int32_5d(tensor, data_in, layout, &

! inputs
integer(kind=int32), intent(in), target :: data_in(:,:,:,:,:) !! Input data that tensor will point at
integer, intent(in) :: layout(5) !! Control order of indices
integer(FT_INT), intent(in) :: layout(5) !! Control order of indices
integer(c_int), intent(in) :: c_device_type !! Device type the tensor will live on (`torch_kCPU` or `torch_kCUDA`)
integer(c_int), optional, intent(in) :: device_index !! device index to use for `torch_kCUDA` case
logical, optional, intent(in) :: requires_grad !! Whether gradients need to be computed for the created tensor
Expand All @@ -1307,7 +1307,7 @@ subroutine torch_tensor_from_array_int32_5d(tensor, data_in, layout, &
integer(c_int), parameter :: c_dtype = torch_kInt32 !! Data type
integer(c_int64_t) :: strides(5) !! Strides for accessing data
integer(c_int), parameter :: ndims = 5 !! Number of dimension of input data
integer :: i
integer(FT_INT) :: i
integer(c_int) :: device_index_value
logical :: requires_grad_value !! Whether gradients need to be computed for the created tensor

Expand Down Expand Up @@ -1567,7 +1567,7 @@ subroutine torch_tensor_from_array_int64_5d(tensor, data_in, layout, &

! inputs
integer(kind=int64), intent(in), target :: data_in(:,:,:,:,:) !! Input data that tensor will point at
integer, intent(in) :: layout(5) !! Control order of indices
integer(FT_INT), intent(in) :: layout(5) !! Control order of indices
integer(c_int), intent(in) :: c_device_type !! Device type the tensor will live on (`torch_kCPU` or `torch_kCUDA`)
integer(c_int), optional, intent(in) :: device_index !! device index to use for `torch_kCUDA` case
logical, optional, intent(in) :: requires_grad !! Whether gradients need to be computed for the created tensor
Expand All @@ -1577,7 +1577,7 @@ subroutine torch_tensor_from_array_int64_5d(tensor, data_in, layout, &
integer(c_int), parameter :: c_dtype = torch_kInt64 !! Data type
integer(c_int64_t) :: strides(5) !! Strides for accessing data
integer(c_int), parameter :: ndims = 5 !! Number of dimension of input data
integer :: i
integer(FT_INT) :: i
integer(c_int) :: device_index_value
logical :: requires_grad_value !! Whether gradients need to be computed for the created tensor

Expand Down Expand Up @@ -1837,7 +1837,7 @@ subroutine torch_tensor_from_array_real32_5d(tensor, data_in, layout, &

! inputs
real(kind=real32), intent(in), target :: data_in(:,:,:,:,:) !! Input data that tensor will point at
integer, intent(in) :: layout(5) !! Control order of indices
integer(FT_INT), intent(in) :: layout(5) !! Control order of indices
integer(c_int), intent(in) :: c_device_type !! Device type the tensor will live on (`torch_kCPU` or `torch_kCUDA`)
integer(c_int), optional, intent(in) :: device_index !! device index to use for `torch_kCUDA` case
logical, optional, intent(in) :: requires_grad !! Whether gradients need to be computed for the created tensor
Expand All @@ -1847,7 +1847,7 @@ subroutine torch_tensor_from_array_real32_5d(tensor, data_in, layout, &
integer(c_int), parameter :: c_dtype = torch_kFloat32 !! Data type
integer(c_int64_t) :: strides(5) !! Strides for accessing data
integer(c_int), parameter :: ndims = 5 !! Number of dimension of input data
integer :: i
integer(FT_INT) :: i
integer(c_int) :: device_index_value
logical :: requires_grad_value !! Whether gradients need to be computed for the created tensor

Expand Down Expand Up @@ -2107,7 +2107,7 @@ subroutine torch_tensor_from_array_real64_5d(tensor, data_in, layout, &

! inputs
real(kind=real64), intent(in), target :: data_in(:,:,:,:,:) !! Input data that tensor will point at
integer, intent(in) :: layout(5) !! Control order of indices
integer(FT_INT), intent(in) :: layout(5) !! Control order of indices
integer(c_int), intent(in) :: c_device_type !! Device type the tensor will live on (`torch_kCPU` or `torch_kCUDA`)
integer(c_int), optional, intent(in) :: device_index !! device index to use for `torch_kCUDA` case
logical, optional, intent(in) :: requires_grad !! Whether gradients need to be computed for the created tensor
Expand All @@ -2117,7 +2117,7 @@ subroutine torch_tensor_from_array_real64_5d(tensor, data_in, layout, &
integer(c_int), parameter :: c_dtype = torch_kFloat64 !! Data type
integer(c_int64_t) :: strides(5) !! Strides for accessing data
integer(c_int), parameter :: ndims = 5 !! Number of dimension of input data
integer :: i
integer(FT_INT) :: i
integer(c_int) :: device_index_value
logical :: requires_grad_value !! Whether gradients need to be computed for the created tensor

Expand Down
2 changes: 1 addition & 1 deletion src/ftorch.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module ftorch

implicit none

integer, parameter :: FT_INT = int32 ! set integer size for FTorch library
integer, parameter :: FT_INT = int64 ! set integer size for FTorch library

!> Type for holding a torch neural net (nn.Module).
type torch_model
Expand Down

0 comments on commit b22bb54

Please sign in to comment.