Cardinality of automorphism groups of groups of order $p^4$. As far as I know there is no classification of the automorphism groups of groups of order $p^4$. (see https://mathoverflow.net/questions/157049/classification-of-automorphism-groups-of-groups-of-order-p4)
However, I was wondering if the cardinality of these groups is known.
I saw that there are some "strong" facts about the cardinality of automorphim groups of $p$ groups $G$ even when Aut$(G)$ is not known. For example if $|G|=p^n$ when $n>1$ then $p$ divides $|$Aut$(G)|$.
Also for $2\leq n\leq 7$ if $G$ is non-abelian, it is known that $|G|$ divides $|$Aut$(G)|$.  
The classification of the groups of order $p^4$ can be found here http://www.gutenberg.org/ebooks/40395
 A: You might want to look first at the case of $q>p$. In that case I think it will be relatively straightforward -- you get 15 or 16 such groups, I think, and only group #15 (for P) gives a nontrivial product. If $q<p$ it will get messy, in particular if $q$ is small -- for example there are 79 groups of your type of order $5^42^2$.
In case you want to play with it, here is a GAP function that constructs these groups -- it relies on the fact that isomorphism is easy.
PvierQzwei:=function(p,q)
local i,n,l,b,a,au,emb,loc,h,s,su,sul,aui;
  l:=[];
  b:=AbelianGroup([q,q]);
  for n in [1..NrSmallGroups(p^4)] do
    a:=SmallGroup(p^4,n);
    Add(l,DirectProduct(b,a));
    au:=AutomorphismGroup(a);
    aui:=IsomorphismPermGroup(au);
    # 3 kinds of homomorphisms, image 1,
    # q (which generator does not matter), q^2
    emb:=["triv"];
    s:=SylowSubgroup(au,q);
    su:=List(ConjugacyClassesSubgroups(s),Representative);
    su:=Filtered(su,x->Size(x)=q or (Size(x)=q^2 and not IsCyclic(x)));
    # conjugacy in full automorphism group
    if Length(su)>2 then
      aui:=aui*SmallerDegreePermutationRepresentation(Image(aui));
    fi;
    su:=SubgroupsOrbitsAndNormalizers(Image(aui,au),
      List(su,x->Image(aui,x)),false);
    su:=List(su,x->PreImage(aui,x.representative));
    for i in [q,q^2] do
      loc:=[];
      sul:=Filtered(su,x->Size(x)=i);
      for s in sul do
        h:=SemidirectProduct(b,
          GroupHomomorphismByImagesNC(b,au,[b.1,b.2],
                  Concatenation(MinimalGeneratingSet(s),
                    [One(au)]){[1,2]}),a);
        Add(loc,h);
      od;
      if Length(loc)>0 then
        Print(n,",",i,": ",Length(loc),"\n");
      fi;
      Append(l,loc);

    od;

  od;
  return l;
end;

