Discrete:
The space of actions is limited. I use CartPole-v0 for test.
Continuous:
The space of actions is unlimited, and the shape of action is usually a list. I use Pendulum-v0 for test.
mode = 'continuous'
# mode = 'discrete'
GAME = 'CartPole-v0' if mode == 'discrete' else 'Pendulum-v0'
if mode == 'discrete': # Note:The action_space of CartPole-v0 does not contain attribute 'shape'.
N_A = env.action_space.n
elif mode == 'continuous': # Note: The action of Pendulum-v0 is a list with shape (1,).
N_A = env.action_space.shape[0]