Given an extension $1 \to N \to P \to Q \to 1$ of p-groups. Is it true that $$\dim H^\ast(P,\mathbb{F}_p) = \dim \text{im}(res^P_N) + \dim \text{im}(inf^P_Q)$$ where $\dim$ denotes the Krull dimension, $res$ the restriction and $inf$ the inflation homomorphism ?

Note that the image of the restriction resp. inflation is just the fibre resp. base in the $E_\infty$ term of the Hochschild-Serre spectral sequence of the extension.

This formula holds for abelian p-groups and I also checked it for various extensions of groups of order $p^3$ like Quaternion group and Dihedral group.