Traceback (most recent call last):
File "D:/Tony/Documents/yunpan/invest/2022/quant/gym/study PG/PG/pg.py", line 219, in <module>
agent.load()
File "D:/Tony/Documents/yunpan/invest/2022/quant/gym/study PG/PG/pg.py", line 161, in load
tl.files.load_hdf5_to_weights_in_order(os.path.join(path, 'pg_policy.hdf5'), self.model)
File "D:\Anaconda3\envs\gym_env\lib\site-packages\tensorlayer\files\utils.py", line 2729, in load_hdf5_to_weights_in_order
_load_weights_from_hdf5_group_in_order(f, network.all_layers)
File "D:\Anaconda3\envs\gym_env\lib\site-packages\tensorlayer\files\utils.py", line 2618, in _load_weights_from_hdf5_group_in_order
assign_tf_variable(layer.all_weights[iid], np.asarray(g[w_name]))
IndexError: list index out of range
New Issue Checklist
Issue Description
IndexError: list index out of range
Reproducible Code
https://github.com/tensorlayer/tensorlayer/blob/master/examples/reinforcement_learning/tutorial_PG.py Because of the previous issue AttributeError: 'str' object has no attribute 'decode' , I modified code of
\tensorlayer\files\utils.py
, line 2617 toweight_names = [n if isinstance(n, str) else n.decode('utf8') for n in f.attrs["layer_names"]]
then :