@@ -59,15 +59,7 @@ module subroutine get_hdf5_dataset_real32_1d(filename, object_name, values)
5959 call f % open (filename, ' r' )
6060 call f % shape (object_name, dims)
6161
62- ! If values is already allocated, re-allocate only if incorrect shape
63- if (allocated (values)) then
64- if (.not. all (shape (values) == dims)) then
65- deallocate (values)
66- allocate (values(dims(1 )))
67- end if
68- else
69- allocate (values(dims(1 )))
70- end if
62+ allocate (values(dims(1 )))
7163
7264 call f % read (object_name, values)
7365 call f % close ()
@@ -92,7 +84,7 @@ module subroutine get_hdf5_dataset_real32_2d(filename, object_name, values)
9284 call f % read (object_name, values)
9385 call f % close ()
9486
95- ! Transpose the array to get from C to Fortran order
87+ ! Transpose the array to respect Keras's storage order
9688 values = transpose (values)
9789
9890 end subroutine get_hdf5_dataset_real32_2d
@@ -115,13 +107,6 @@ module subroutine get_hdf5_dataset_real32_4d(filename, object_name, values)
115107 call f % read (object_name, values)
116108 call f % close ()
117109
118- ! Transpose the array to get from C to Fortran order
119- values = reshape ( &
120- values, &
121- shape= [dims(4 ), dims(3 ), dims(2 ), dims(1 )], &
122- order= [4 , 3 , 2 , 1 ] &
123- )
124-
125110 end subroutine get_hdf5_dataset_real32_4d
126111
127112end submodule nf_io_hdf5_submodule
0 commit comments