I'm tinkering with tf-agents but I'm having trouble making a custom time_step_spec.
I'm trying to train a tf-agent in gym 'Breakout-v0', I've made a function to preprocess the observation (game pixels) and now I want to modify the time_step and time_step_spec to reflect the new data.
original 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))
mine would be:
BoundedTensorSpec(shape=(1, 165, 150), dtype=tf.float32, name='observation', minimum=array(0., dtype=float32), maximum=array(1., dtype=float32))
I've managed to create a custom BoundedTensorSpec and modify the time_step with the function
processed_timestep = timestep._replace(observation=processed_obs)
now I'm having trouble understanding how to modify the time_step_spec I don't fully understand what is it, nor how to modify its components.
original time_step_spec is:
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)))
What structure is it exactly? an array of tensors?
How can I access its components?
Can I make a custom time_step_spec with multiple components? (reward, observation, etc.)
Can I just modify a single component?