Search Unity

Execution Order of WriteDiscreteActionMask and CollectObservations

Discussion in 'ML-Agents' started by airoll, Oct 13, 2021.

  1. airoll

    airoll

    Joined:
    Jan 12, 2021
    Posts:
    37
    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.
     
  2. miguelalonsojr

    miguelalonsojr

    Unity Technologies

    Joined:
    Jan 13, 2021
    Posts:
    8
    Hi,

    Have a look at

    https://github.com/Unity-Technologi...4e/com.unity.ml-agents/Runtime/Agent.cs#L1078

    CollectObservations is called before any calls related to action masking (https://github.com/Unity-Technologi...4e/com.unity.ml-agents/Runtime/Agent.cs#L1083).

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

    https://github.com/Unity-Technologi...4e/com.unity.ml-agents/Runtime/Agent.cs#L1177.

    Hope this helps.
    -M.
     
    airoll likes this.