$x$ is of shape $1 \times d$
$W$ is of shape $d \times k$
$f(W) = log(\sum e^{xW})$
Here the summation is over the $k$ elements after applying the exponent to the vector product $xW$
I have to find the derivative of $f(W)$ with respect to $W$.
Here's what I've done:
Let's assume a vector $\bf{1}$ of shape $k \times 1$ whose each element is 1. Thus $f(W) = log(e^{xW}\bf{1})$
$$\frac{\partial}{\partial W}f(W) = \frac{\partial}{\partial W}log(e^{xW}\bf{1})$$ Using the chain rule: $$=x^T e^{xW} \mathbf{1} \frac{1}{e^{xW}\mathbf{1}}$$ $$=x^T$$
Is that correct? Shouldn't the shape of the derivative be same as the quantity with respect to which it was differentiated i.e. $W$?
First, let's use column vectors rather than row vectors, i.e. wherever you've used $x$ I'll use $x^T$.
Next, define some new variables to reduce the visual clutter. $$\eqalign{ y,p,{\tt 1} &\in{\mathbb R}^{k\times 1} \\ y &= W^Tx &\implies dy = dW^Tx \\ p &= \exp(y) &\implies dp = p\odot dy \\ \phi &= {\tt 1}:p &\implies d\phi = {\tt 1}:dp \\ \lambda &= \phi^{-1} \\ }$$ where ${\tt 1}$ is a vector of all ones, the exponential function is applied elementwise, $(\odot)$ is the elementwise/Hadamard product, and $(:)$ is the trace/Frobenius product, i.e. $\;A:B = {\rm Tr}(A^TB)$.
Write the function in terms of the new variables. Then find its differential and gradient. $$\eqalign{ f &= \log(\phi) \\ df &= d\log(\phi) \\ &= \lambda\,d\phi \\ &= \lambda\,{\tt 1}:dp \\ &= \lambda\,{\tt 1}:p\odot dy \\ &= \lambda\,p:dy \\ &= \lambda\,p:dW^Tx \\ &= \lambda\,p^T:x^TdW \\ &= \lambda\,xp^T:dW \\ \frac{\partial f}{\partial W} &= \lambda\,xp^T \;\in\,{\mathbb R}^{d\times k} \\ \\ }$$ So, as you suspected, the gradient has the same shape as $W$.