Gradient-vector product and vector-gradient product for higher-order gradients

Hi,

I’m trying to find out what’s the best way to calculate the gradient-vector product and the vector-gradient product for hessian, and third-order gradients?

Or, more generally, how to calculate the products

image

if A is a tensor?

Thanks,
JW