Jacobian in a tensor flow

I see that many people ask this question here, but I have not seen the code that I can execute. I am trying to do two operations to get dOuput / dInput and get dOutput / dParameters. I tried

    # gradient method 1
    jac_Action_wrt_Param = tf.pack([tf.concat(1, [tf.reshape(tf.gradients(action_output[:, idx], param)[0], [1, -1])
                                                  for param in learnable_param_list]) for idx in range(action_dim)],
                                   axis=1, name='jac_Action_wrt_Param')
    jac_Action_wrt_State = tf.pack(
        [tf.gradients(action_output[:, idx], state_input)[0] for idx in range(action_dim)], axis=1,
        name='jac_Action_wrt_State')

Here the state is the input, and the action is issued. Both methods give nothing ... What have I done wrong?

+4
source share

Source: https://habr.com/ru/post/1667636/


All Articles