f = h5py.File("encoder_weights_0.hdf5", "r") print(f.filename, ":") print(f['dense_1']) print([key for key in f.keys()], "\n") for key in f.keys(): print(key,f[key]) for k in f[key].keys(): print(k,f[key][k]) for l in f[key][k].keys(): print(l, f[key][k][l])
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<HDF5 group "/dense_1" (1 members)> ['dense_1', 'dense_2', 'dense_3', 'input_1']
dense_1 <HDF5 group "/dense_1" (1 members)> dense_1 <HDF5 group "/dense_1/dense_1" (2 members)> bias:0 <HDF5 dataset "bias:0": shape (64,), type "<f4"> kernel:0 <HDF5 dataset "kernel:0": shape (100, 64), type "<f4"> dense_2 <HDF5 group "/dense_2" (1 members)> dense_2 <HDF5 group "/dense_2/dense_2" (2 members)> bias:0 <HDF5 dataset "bias:0": shape (16,), type "<f4"> kernel:0 <HDF5 dataset "kernel:0": shape (64, 16), type "<f4"> dense_3 <HDF5 group "/dense_3" (1 members)> dense_3 <HDF5 group "/dense_3/dense_3" (2 members)> bias:0 <HDF5 dataset "bias:0": shape (8,), type "<f4"> kernel:0 <HDF5 dataset "kernel:0": shape (16, 8), type "<f4"> input_1 <HDF5 group "/input_1" (0 members)>
a Dense layer returns a list of two values– per-output weights and the bias value. 在