Solved by alexis-jacq in post #2 
              
              
                There is no need to learn which action is or is not allowed. By setting the forbidden actions probabilities to zero, your agent will only explore the allowed ones and learn what is the best action out of the allowed set. 
However, if you want to reduce the log_prob of the forbidden actions in your g…