Execution Order of WriteDiscreteActionMask and CollectObservations

What is the execution order of WriteDiscreteActionMask and CollectObservations? Does WriteDiscreteActionMask execute after CollectObservations? I’m wondering if some of the data I’m processing in CollectObservations can be used in WriteDiscreteActionMask.

Hi,

Have a look at

CollectObservations is called before any calls related to action masking (ml-agents/com.unity.ml-agents/Runtime/Agent.cs at 05c027551e296291d8110165b23b6ad417fe9a4e · Unity-Technologies/ml-agents · GitHub).

If you’d like to use the collected observations for other data processing, you can grab the collected observations using GetObservations():

ml-agents/com.unity.ml-agents/Runtime/Agent.cs at 05c027551e296291d8110165b23b6ad417fe9a4e · Unity-Technologies/ml-agents · GitHub.

Hope this helps.
-M.

1 Like