For your stack overflow question. The batch size is 8 and by using the .gather(1, action_batch), you select the one action that was made out of the 2 possible. and so you get an output of size [8, 1].