naturomics/CapsNet-Tensorflow

Improper loop of b_IJ

Closed this issue · 1 comments

Hi,
Thanks for your great job. I found that the b_IJ is update with the order of J in your code.
In CapsConv

            for j in range(self.num_outputs):
                with tf.variable_scope('caps_' + str(j)):
                    caps_j, b_IJ = capsule(input, b_IJ, j)
                    capsules.append(caps_j)

In capsule
c_IJ = tf.nn.softmax(b_IJ, dim=2)

In your case, b_I(J+1) is not independent with b_IJ, which means the sequence matter the routing process. But in my opinion, all b_IJ should be update in parallel. Thanks for your reply in advance!

Fixed by rewriting the whole routing algorithm in a matrix way