This is a matter of how you want to control the dimension of variables.
Your implementation is one of the ways. I prefer to control the dimension by myself, since all variables in parameters are 2D-array not a vector. And, a vector handling in numpy is slightly unique, and not portable. So, my approach is different. But, of course, it depends on you. Here is the link related to this topics. For your information.