PYTHON:shape =(None,)+ state_dim

2020-03-20  本文已影响0人  zelda2333

转自:shape=(None,)+stat_dim & shape=(None, state_dim)区别

>>> stat_dim = (1, 2, 3)
>>> (None,) + stat_dim
(None, 1, 2, 3)
>>> (1, 2) + (3, 4)
(1, 2, 3, 4)
>>> shape = (None,) + stat_dim
>>> shape[2]
2
>>> (None, stat_dim)
(None, (1, 2, 3))
>>> ((1, 2), (3, 4))
((1, 2), (3, 4)

所以现在没有shape[2]; 只有shape[0]和shape[1],然后shape[1]有自己的元素:

>>> shape = (None, stat_dim)
>>> shape[2]
IndexError: tuple index out of range
>>> shape[1][2]
3
上一篇 下一篇

猜你喜欢

热点阅读