@@ -59,15 +59,7 @@ module subroutine get_hdf5_dataset_real32_1d(filename, object_name, values)
59
59
call f % open (filename, ' r' )
60
60
call f % shape (object_name, dims)
61
61
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 )))
71
63
72
64
call f % read (object_name, values)
73
65
call f % close ()
@@ -92,7 +84,7 @@ module subroutine get_hdf5_dataset_real32_2d(filename, object_name, values)
92
84
call f % read (object_name, values)
93
85
call f % close ()
94
86
95
- ! Transpose the array to get from C to Fortran order
87
+ ! Transpose the array to respect Keras's storage order
96
88
values = transpose (values)
97
89
98
90
end subroutine get_hdf5_dataset_real32_2d
@@ -115,13 +107,6 @@ module subroutine get_hdf5_dataset_real32_4d(filename, object_name, values)
115
107
call f % read (object_name, values)
116
108
call f % close ()
117
109
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
-
125
110
end subroutine get_hdf5_dataset_real32_4d
126
111
127
112
end submodule nf_io_hdf5_submodule
0 commit comments