h5ファイルのNN重みの中身を見る

5つのh5ファイルの重みが正しく更新されているかどうかを調べたく、
h5ファイルの中身を見たい！

[【Python】kerasで保存したweightsをh5pyを使って取得する](https://pynote.hatenablog.com/entry/keras-file-format)

を参考に、`.keys()`,`.get(~)`を見て試行錯誤した。

```python:
import h5py

for i in range(5):
	print("------{}------".format(i+1))
	file = h5py.File("./result_path/episode_{}0000.h5".format(i+1)) # ファイルの読み込み
	model_weights = file["model_weights"]
	layers = list(model_weights.keys())
	# for layer in layers:
	# 	print(model_weights[layer].keys())
	layers = ["dense","hidden_1","hidden_2","hidden_3","log_var","mu"]
	# print(model_weights["dense"].get("dense").get("bias:0")[()])
	# print(model_weights["hidden_1"].get("hidden_1").get("bias:0")[()])
	# print(model_weights["hidden_2"].get("hidden_2").get("bias:0")[()])
	# print(model_weights["hidden_3"].get("hidden_3").get("bias:0")[()])
	# print(model_weights["log_var"].get("log_var").get("bias:0")[()])
	# print(model_weights["mu"].get("mu").get("bias:0")[()])
	for layer in layers:
		print(layer)
		print(model_weights[layer].get(layer).get("bias:0")[()])
```


```
pc$ python3 weight.py
------1------
weight.py:5: H5pyDeprecationWarning: The default file mode will change to 'r' (
ead-only) in h5py 3.0. To suppress this warning, pass the mode you need to h5py
File(), or set the global default h5.get_config().default_file_mode, or set the
environment variable H5PY_DEFAULT_READONLY=1. Available modes are: 'r', 'r+', '
', 'w-'/'x', 'a'. See the docs for details.
  file = h5py.File("./result/walker2d/20210122_143959_epi/episode_{}0000.h5".fo
mat(i+1))
dense
[-0.2993213  -0.32194233  0.11839359 -0.09928301 -0.31124848 -0.3751496
 -0.3678569   0.1899587  -0.08569791 -0.01822463  0.02833614  0.01277389
 -0.02882302 -0.06589823  0.03802811 -0.031959   -0.05847006 -0.0986212
 -0.33697262 -0.05775459 -0.10717085 -0.34125197]
hidden_1
[ 0.01285853 -0.01230553 -0.00388967 -0.02433562  0.00179267 -0.01015067
  0.01279763  0.00089996  0.00513106 -0.01144475  0.00831929  0.0088335
  0.00711508  0.00678137  0.01632852  0.00094608]
hidden_2
[-0.01643273  0.01181548  0.01352771 -0.001769   -0.01567042 -0.01673872
  0.001208    0.0133812  -0.00511519 -0.00952019 -0.02292812  0.01551038
 -0.0003822   0.02179182  0.00771308 -0.01250312]
hidden_3
[ 0.00147426  0.01081525 -0.00514209 -0.03740762 -0.01695448 -0.02615813
 -0.01724532 -0.01179097 -0.0363163  -0.01086682  0.0169599  -0.00024146
 -0.01046261 -0.02178889  0.02703306 -0.00139732 -0.00190802  0.01164212
  0.00064688  0.00502167 -0.00390945 -0.03841734  0.00580032 -0.02683658
  0.01183896 -0.00594397 -0.03564184 -0.00268949  0.02109798 -0.00184922
  0.01308736  0.0183714  -0.01773291  0.00852762 -0.02282826  0.00185806
 -0.0178623  -0.02092414 -0.00946022 -0.012106   -0.0302344  -0.02267631
 -0.02971576 -0.02076597 -0.01282861 -0.01714998 -0.00485182 -0.02255891
 -0.00863784  0.00695363  0.02177046 -0.02126798 -0.02255806  0.02550721
  0.00818296  0.00872978 -0.01019798 -0.0029075  -0.00304889  0.01568063]
log_var
[-0.26622045 -0.44091797 -0.2419649  -0.50653774 -0.36543489 -0.18883663]
mu
[ 0.05976096  0.03247268  0.00452811 -0.0034478  -0.03532023  0.04368779]
------2------
dense
[-0.42575213 -0.4498407   0.16496097 -0.25781444 -0.39711034 -0.45612583
 -0.49852094  0.2791475  -0.04682539  0.0053675   0.10432086 -0.05520683
 -0.09059926  0.07662117 -0.06888733 -0.04932804 -0.05911314 -0.21280894
 -0.45909563 -0.18084827 -0.11217871 -0.42897993]
hidden_1
[ 0.0169547   0.00135951 -0.00641266 -0.01012402  0.00021668 -0.00809189
  0.00516283 -0.00121518  0.01503234 -0.0133448   0.02960026  0.00107891
 -0.00836505  0.01001229  0.00759052  0.00075823]
hidden_2
[-0.03121149  0.01105501  0.00353613  0.00630521 -0.03281696 -0.03234349
  0.00590976  0.01714135 -0.03656695  0.01059771 -0.01879915  0.0182774
 -0.01051105  0.01707695 -0.00700341  0.00888611]
hidden_3
[-0.00174479 -0.00838945 -0.03810974 -0.01638342  0.00310101  0.00047198
 -0.01974851 -0.02552811  0.00858791 -0.00421809  0.00086814 -0.00352836
 -0.00398448 -0.0075184   0.03037225 -0.00200673 -0.00742958 -0.00661159
 -0.01234769  0.01912175  0.00099004  0.00580208 -0.01445077 -0.01215665
  0.01352465 -0.00839235 -0.01136181 -0.0150891   0.00322541  0.00430215
  0.00805547  0.01957959 -0.00584291  0.01372828 -0.01055162 -0.00989193
 -0.03023658 -0.03651182 -0.00137293 -0.00502513 -0.00477335 -0.03991703
 -0.00154987  0.00352569 -0.01544962 -0.01001886 -0.00758626 -0.04234054
  0.01167532  0.02955389  0.02831114  0.0034275  -0.01159023  0.01606458
  0.00734266 -0.00485118 -0.01415251  0.01226815 -0.006758    0.02537185]
log_var
[-0.2284169  -0.3882995  -0.23325028 -0.48085243 -0.29607776 -0.05214483]
mu
[ 0.09707549 -0.02336518  0.03843829 -0.0059326  -0.06028875  0.16774386]
------3------
dense
[-0.3609201  -0.4038263   0.18953307 -0.3221238  -0.34733847 -0.39199328
 -0.50452036  0.3464602  -0.07979373  0.09677191  0.06821929 -0.02858738
 -0.08285121 -0.02647901 -0.06329241 -0.0464786  -0.05543575 -0.27278653
 -0.43914935 -0.15375452 -0.09366758 -0.39211708]
hidden_1
[ 0.01637724 -0.00586867 -0.00091257 -0.0220271   0.00989103 -0.00159342
  0.01516735  0.01175526  0.01859576 -0.01689171 -0.01568438 -0.00529172
  0.00313585  0.0109848   0.01243033 -0.00219891]
hidden_2
[-0.01441067  0.03176265 -0.00455891  0.01592212  0.00100191 -0.00104676
  0.00113423  0.01372305 -0.02879625  0.01738748  0.00476962  0.01931044
 -0.01249406  0.004782   -0.00502662  0.00121921]
hidden_3
[ 0.02300977 -0.01313633  0.00602289  0.00586655 -0.01930383 -0.00678339
 -0.01294483 -0.00265931 -0.01821144 -0.00046318  0.0075395  -0.00424121
 -0.00837085 -0.01992738  0.0501219   0.02281669  0.00978312  0.00380054
 -0.02079066 -0.01900988 -0.00998911 -0.02499146 -0.01035645 -0.01753384
 -0.00778861 -0.00391977 -0.01730437 -0.0149233   0.02815877  0.01600625
  0.01011903  0.01202185  0.0095513  -0.01818707 -0.01557177 -0.0093669
 -0.05587415 -0.01565717 -0.00363236 -0.00386564 -0.01481221 -0.02848075
 -0.00265851 -0.01358179  0.00700456 -0.0005413  -0.00315622 -0.02419036
 -0.00215404  0.00882866  0.02737095  0.00691985  0.00981182 -0.00604119
  0.02055109 -0.00220829 -0.00786867  0.00056195 -0.00128857  0.05296057]
log_var
[-0.18568064 -0.42112157 -0.10640209 -0.4720275  -0.3076731  -0.05898004]
mu
[ 0.12181789 -0.07251222  0.10192874 -0.02079329  0.00843742  0.11063012]
------4------
dense
[-0.45512405 -0.4792948   0.19997866 -0.4356516  -0.43723622 -0.44441482
 -0.6207231   0.390794   -0.20586368  0.24317113  0.08350939 -0.01324948
 -0.23957846 -0.10354955 -0.11590306 -0.1011933  -0.03096447 -0.33722648
 -0.52121156  0.02860512 -0.06179736 -0.4931039 ]
hidden_1
[ 0.0098588  -0.00885933 -0.01049567 -0.02240602  0.01429007 -0.00334164
  0.02016274  0.01544681  0.01102758  0.02213593  0.00463183  0.00502532
 -0.00267633 -0.01370771  0.01710366 -0.02348411]
hidden_2
[-0.01441815  0.00403282 -0.02799178  0.00785748 -0.00535665 -0.03183194
 -0.01195905 -0.00031165 -0.04085694 -0.02425708 -0.00241232  0.04176614
 -0.02035664  0.03019036  0.0062063   0.05299307]
hidden_3
[-0.05234769  0.00370329 -0.09656766 -0.05031026 -0.02526811  0.02819046
  0.04432523 -0.07284088 -0.04559707  0.03193165  0.00657521  0.03995736
  0.02470329 -0.03026467  0.02126475 -0.05329533 -0.04604874 -0.01832408
  0.02986939  0.03204302  0.02071415  0.02890907  0.01348515 -0.01197762
  0.035567   -0.00641954 -0.01039144 -0.0226956  -0.02152967 -0.01170264
  0.05216637  0.06210339 -0.02049457 -0.03548224 -0.11461961  0.03478845
 -0.03264535 -0.05490202  0.02964461 -0.01698051 -0.04792651 -0.06926097
  0.00341674 -0.00304062 -0.01643956 -0.09868644 -0.04623813 -0.12408376
  0.0737886   0.02389593  0.03864462  0.00275503  0.02826896  0.02527355
  0.00502198  0.00127364 -0.04877707  0.07355893  0.00095519  0.01632655]
log_var
[-0.2149527  -0.43429127 -0.12096979 -0.4642315  -0.24396077 -0.19962847]
mu
[ 0.11146773 -0.04464803  0.08049753  0.05853469 -0.05219817  0.20106995]
------5------
dense
[-0.514686   -0.51815444  0.16813129 -0.4805155  -0.51214296 -0.48490146
 -0.69934314  0.40153962 -0.16017234  0.21786498  0.07586032  0.06848594
 -0.2371331  -0.15719014 -0.163361   -0.02760048 -0.07600322 -0.37585324
 -0.5784061   0.00175215 -0.08469447 -0.5798797 ]
hidden_1
[ 0.01126834 -0.01231832 -0.00937062 -0.02195915  0.01400331 -0.03649899
  0.01753567  0.01351106  0.00537443 -0.02163706  0.02746029  0.00847202
 -0.00236308 -0.00263122  0.0118852  -0.00533856]
hidden_2
[-0.03975146  0.02691265  0.00718811  0.01240622 -0.02857937  0.03555348
 -0.00756482 -0.00221284 -0.03636038 -0.02479281 -0.01452929  0.03175795
 -0.01004493  0.03761677  0.01006705 -0.00341219]
hidden_3
[-0.02854635  0.01539811 -0.06664139 -0.04924892 -0.03209276 -0.01373351
 -0.02575772 -0.06562782 -0.04508246  0.01164096  0.03203472  0.00851271
 -0.01285799 -0.038576    0.03442601 -0.03492095 -0.00730774 -0.02902594
  0.01413057  0.01179908  0.03825828 -0.0167208  -0.02566672 -0.01650032
  0.00543993  0.02678551 -0.02480492 -0.02948821  0.01369712 -0.00691305
  0.02009066  0.01754091 -0.03031769  0.01738846 -0.0574885   0.04089386
 -0.02611405 -0.065906    0.00831986 -0.03634514 -0.00802476 -0.09968716
 -0.02643104  0.00783725 -0.04775301 -0.0802675  -0.02175665 -0.10979362
  0.02718254  0.01011948  0.03617569  0.0068545   0.00662172  0.05393337
  0.03099504  0.0210703  -0.01106016  0.0718689  -0.01067457  0.0026848 ]
log_var
[-0.21639466 -0.42551097 -0.11998599 -0.4593208  -0.26696658 -0.23223357]
mu
[ 0.11872804 -0.04876811  0.09173425  0.09657543 -0.0226907   0.21999218]
```