我正在修改 tf-agents,但在定制时遇到问题time_step_spec
.
我正在尝试在健身房“Breakout-v0”中训练 tf-agent,我已经制作了一个函数来预处理观察结果(游戏像素),现在我想修改 time_step 和 time_step_spec 以反映新数据。
原来的time_step_spec.observation()
is:
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 吗? (奖励、观察等)
我可以只修改单个组件吗?