Skip to content

Commit 782e601

Browse files
committed
Reading coefficients from h5f model
Note a hardcoded 'simple_rnn_cell_23' that must be resolved later.
1 parent 160a36d commit 782e601

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/nf/nf_network_submodule.f90

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,23 @@ module function network_from_keras(filename) result(res)
216216
! Nothing to do
217217
continue
218218

219+
type is(rnn_layer)
220+
221+
! Read biases from file
222+
object_name = '/model_weights/' // layer_name // '/' &
223+
// layer_name // '/simple_rnn_cell_23/bias:0'
224+
call get_hdf5_dataset(filename, object_name, this_layer % biases)
225+
226+
! Read weights from file
227+
object_name = '/model_weights/' // layer_name // '/' &
228+
// layer_name // '/simple_rnn_cell_23/kernel:0'
229+
call get_hdf5_dataset(filename, object_name, this_layer % weights)
230+
231+
! Read recurrent weights from file
232+
object_name = '/model_weights/' // layer_name // '/' &
233+
// layer_name // '/simple_rnn_cell_23/recurrent_kernel:0'
234+
call get_hdf5_dataset(filename, object_name, this_layer % recurrent)
235+
219236
class default
220237
error stop 'Internal error in network_from_keras(); ' &
221238
// 'mismatch in layer types between the Keras and ' &

0 commit comments

Comments
 (0)