Solved by albanD in post #4 
              
              
                Hi, 
I think the misconception here is between vector jacobian product vs jacobian vector product. 
Reverse mode AD that all DL framework use for vector jacobian products. Where v is of the size of the input. 
If you want to do jacobian vector product, (and so v is the same size as the input), you n…