We demonstrate that inference-based goal-directed behavior can be done by utilizing the temporal gradients in recurrent neural network (RNN). The RNN learns a dynamic sensorimotor forward model. Once the RNN is trained, it can be used to execute active-inference-based, goal-directed policy optimization. The internal neural activities of the trained RNN essentially model the predictive state of ...