distribution = Categorical(action_probs)
    action = distribution.sample2()

As I have understod it Categorical returns the propabillety of every possible action. Then one possible action gets sampled from this distribution (You can’t just do argmax(action_probs) because in some sence then there would be no exploration also the intension is to increase the propabillety of good actions and decrease the propabillety of bad actions that is why whe have to sample from the distripution instead of chosing the highest value)
I am fairly new to reinforcement learning and python so pleas correct me if I am wrong.