Open masterkey2000 opened 2 years ago
If you don't pass the observation_action_splitter to DQN then the observation contains both the observation and the mask. And the mask is bool which cannot be sampled. Not sure what is the intended use of the mask when you only have 2 actions.
Also can you make sure you have the latest version since sample_nest_spec can now handle tf.bool https://github.com/tensorflow/agents/blob/master/tf_agents/specs/tensor_spec.py#L380
If you don't pass the observation_action_splitter to DQN then the observation contains both the observation and the mask. And the mask is bool which cannot be sampled. Not sure what is the intended use of the mask when you only have 2 actions.
Also with implementation of:
def observation_action_splitter(obs):
return obs['mask'], obs['observation']
and:
observation_and_action_constraint_splitter=observation_action_splitter
the error message persists.
I know that it makes no sence in this example to mask. It should be an easy example to fix this issue.
Also can you make sure you have the latest version since sample_nest_spec can now handle tf.bool https://github.com/tensorflow/agents/blob/master/tf_agents/specs/tensor_spec.py#L380
the tf-agents version I use is 0.12.0
Hello,
I am currently trying to build a DQN where the legal actions are to be masked. To understand the whole thing I built a small test setup. I also want to use the observation_and_action_constraint_splitter. I haven't applied it yet, because I get an error message before. Maybe someone can help me.
As starting point I took the example from @ormandi from here: https://github.com/tensorflow/agents/issues/397
The network is a DQN. The complete code is this:
This is the error i get:
Can anyone help me please? Or a sample code with action masking would also be good to understand all this better.
Thank you!