import tensorflow as tf

            for i in range(len(self.grads_and_vars)):
                self.grads.append(self.grads_and_vars[i][0]);
                self.vars.append(self.grads_and_vars[i][1]);
            self.grads=self.grads[-1*NUM_VARS:];
            self.vars=self.vars[-1*NUM_VARS:];
            self.train_op = self.optimizer.apply_gradients(
                                    self.grads_and_vars, global_step=tf.contrib.framework.get_global_step())

    def predict(self, state, sess=None):
        sess = sess or tf.get_default_session()
        state=featurize_state(state);
        return sess.run(self.action, { self.state: [state] })[0]
