  CapsNet (Capsule Network) was first proposed by~\citet{capsule} and later
another version of CapsNet was proposed by~\citet{emrouting}. CapsNet has been
proved effective in modeling spatial features with much fewer parameters.
However, the routing procedures in both papers are not well incorporated into
the whole training process. The optimal number of routing procedure is misery
which has to be found manually. To overcome this disadvantages of current
routing procedures in CapsNet, we embed the routing procedure into the
optimization procedure with all other parameters in neural networks, namely,
make coupling coefficients in the routing procedure become completely
trainable. We call it Generalized CapsNet (G-CapsNet). We implement both
"full-connected" version of G-CapsNet and "convolutional" version of G-CapsNet.
G-CapsNet achieves a similar performance in the dataset MNIST as in the
original papers. We also test two capsule packing method (cross feature maps or
with feature maps) from previous convolutional layers and see no evident
difference. Besides, we also explored possibility of stacking multiple capsule
layers. The code is shared on
\hyperlink{https://github.com/chenzhenhua986/CAFFE-CapsNet}{CAFFE-CapsNet}.
