Take Derivative of Quadratic Form but instead do it with a 3rd order tensor in the middle, which maps to a vector. That is, $x \in \mathbb{R}^n$, $A \in \mathbb{R}^{n \times n \times n}$, where we are interested in a reduction along the lines of (apologies if I used the wrong notation) $$ c^i = x_j \, A^{ijk} \,x_k \equiv Q(x, A) $$
So the question then is to find (1) $\frac{\partial Q(x, A)}{\partial x}$ and (2) $\frac{\partial Q(x, A)}{\partial A}$?