Solution (source code)

= Solution

For hidden layers $h^{(r)}=\phi_r(W_rh^{(r-1)}+b_r)$ with $h^{(0)}=x$, the output logits are $z=W_{R+1}h^{(R)}+b_{R+1}$ and the <softmax function> gives
$$
p_\ell(x)=\frac{e^{z_\ell}}{\sum_{j=1}^Le^{z_j}}.
$$