Let $f: \mathbb{R}^a \rightarrow \mathbb{R}$ and $z: \mathbb{R}^b \rightarrow \mathbb{R}^a$ functions of vectors.
I know that computing the partial derivate $\frac{\partial f}{\partial x}$ is computed using the chain rule $$\frac{\partial f}{\partial x} = \sum_i \frac{\partial f}{\partial z_i}\frac{\partial z_i}{\partial x}$$
Does this generalize to matrices? That means, do I need to sum over all entries in the matrix
$$\frac{\partial f}{\partial x} = \sum_{i,j} \frac{\partial f}{\partial z_{i,j}}\frac{\partial z_{i,j}}{\partial x}$$
assuming $z$ and $x$ are defined on some real matrix space?
There's something a little wonky with your formula. I think it should be $$\frac{\partial (f\circ z)}{\partial x_k} =\sum_i \frac{\partial f}{\partial z_i} \frac{\partial z_i}{\partial x_k}$$ To answer your question though, yes it should be the same because when we take matrix derivatives we are implicitly identifying $\text{Mat}_{n\times m}(\mathbb{R})$ with $\mathbb{R}^{nm}$ and taking the derivative in the euclidean space.