What does this line of code do for q_values?

q_values = tf.gather_nd(q_values, tf.stack([tf.range(q_values.shape[0]),
tf.cast(actions, tf.int32)], axis=1))

1 Like

Hi @DaliaAlshahat, there are 4 functions in this line of code. I suggest you to google their tensorflow documentation page for the explaination first.

tf.gather_nd
tf.stack
tf.range
tf.cast