【发布时间】:2019-10-11 20:41:23
【问题描述】:
我正在修改 tf-agents,但在制作自定义 time_step_spec 时遇到问题。
我正在尝试在健身房“Breakout-v0”中训练一个 tf-agent,我已经创建了一个函数来预处理观察结果(游戏像素),现在我想修改 time_step 和 time_step_spec 以反映新数据.
原来time_step_spec.observation()是:
BoundedTensorSpec(shape=(210, 160, 3), dtype=tf.uint8, name='observation', minimum=array(0, dtype=uint8), maximum=array(255, dtype=uint8))
我的应该是:
BoundedTensorSpec(shape=(1, 165, 150), dtype=tf.float32, name='observation', minimum=array(0., dtype=float32), maximum=array(1., dtype=float32))
我已经设法创建了一个自定义的 BoundedTensorSpec 并使用函数修改了 time_step
processed_timestep = timestep._replace(observation=processed_obs)
现在我无法理解如何修改 time_step_spec 我不完全理解它是什么,也不知道如何修改它的组件。
原来的time_step_spec是:
TimeStep(step_type=TensorSpec(shape=(), dtype=tf.int32, name='step_type'), reward=TensorSpec(shape=(), dtype=tf.float32, name='reward'), discount=BoundedTensorSpec(shape=(), dtype=tf.float32, name='discount', minimum=array(0., dtype=float32), maximum=array(1., dtype=float32)), observation=BoundedTensorSpec(shape=(210, 160, 3), dtype=tf.uint8, name='observation', minimum=array(0, dtype=uint8), maximum=array(255, dtype=uint8)))
它到底是什么结构?张量数组?
如何访问其组件?
我可以使用多个组件制作自定义 time_step_spec 吗? (奖励、观察等)
我可以只修改一个组件吗?
【问题讨论】:
标签: python-3.x tensorflow reinforcement-learning