Skip to content

Commit 8916fea

Browse files
authored
Apply fypp (#549)
* Apply fypp * Fix filename in preprocessing workflow * Arrays passed to torch_tensor_from_array need target property
1 parent a65dac7 commit 8916fea

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

.github/workflows/preprocessing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
# Triggers the workflow on pushes to open pull requests with Fortran changes
1010
pull_request:
1111
paths:
12-
- '.github/workflows/fypp_checks.yml'
12+
- '.github/workflows/preprocessing.yml'
1313
- 'ftorch_tensor.f*'
1414
- 'ftorch_test_utils.f*'
1515

src/ftorch_tensor.f90

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,10 @@ end subroutine torch_tensor_ones
344344
! This routine will take an (i, j, k) array and return an (k, j, i) tensor.
345345
!
346346
! Note that `data` needs to be a pointer to a **contiguous** block of memory!
347-
! It is generally not a case when calling `c_loc` on a Fortran array as these may not be
348-
! contiguous as a result of array slicing. Please consider asserting that the data is contiguous
349-
! with `is_contiguous` implicit procedure before calling this routine.
347+
! This is not generally not the case when calling `c_loc` on a Fortran array as
348+
! array slicing can lead to non-contiguous memory.
349+
! Please consider asserting that the data is contiguous with the `is_contiguous`
350+
! implicit procedure before calling this routine.
350351
subroutine torch_tensor_from_blob(tensor, data, ndims, tensor_shape, layout, dtype, &
351352
device_type, device_index, &
352353
requires_grad)

test/unit/tensor/unittest_tensor_manipulation_cuda.pf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ contains
2626
use, intrinsic :: iso_fortran_env, only: sp => real32, dp => real64
2727

2828
type(torch_tensor) :: cpu_tensor, gpu_tensor, temp
29-
real(dp), dimension(2,3,4) :: dp_data
30-
real(sp), dimension(2,3,4) :: sp_data_expected, temp_array
29+
real(dp), dimension(2,3,4), target :: dp_data
30+
real(sp), dimension(2,3,4), target :: temp_array
31+
real(sp), dimension(2,3,4) :: sp_data_expected
3132
integer, parameter :: device_type_source = torch_kCPU
3233
integer, parameter :: device_type_target = torch_kCUDA
3334
integer, parameter :: dtype_source = torch_kFloat64

0 commit comments

Comments
 (0)