Derivative of matrix-valued function with respect to matrix input I have the expression
$$\bf \phi  = \bf X W$$
where $\bf X$ is a $20 \times 10$ matrix, $\bf W$ is a $10 \times 5$ matrix. 
How can I calculate $\frac{d\phi}{d\bf W}$? What is the dimension of the result?    

There is a similar question.
Also, you could define it
$$C = \frac{\partial \phi}{\partial W} $$
where C is a 4D matrix (or tensor) with
$$ C_{a,b,c,d} = \frac{\partial \phi_{a,b}}{\partial W_{c,d}} $$
Actually, when derivatives are expressed as matrices, for example, $f=x^TAx$ where $x\in R^{n\times1}, A\in R^{n\times n}$, you could think of $\frac{\partial f}{\partial A}$ as
$$ \left[\frac{\partial f}{\partial A}\right]_{ij} = \frac{\partial f}{\partial A_{ij}} $$
