def norm(module, init_module, p=2, q=2):
    """
    Calculates l_pq norm of a parameter matrix
      l_p norm of incoming weights to each hidden unit
      l_q norm on the hidden units
    """
    return module.weight.view(module.weight.size(0), -1).norm(p=p, dim=1).norm(q).item()