naturomics / CapsNet-Tensorflow

A Tensorflow implementation of CapsNet(Capsules Net) in paper Dynamic Routing Between Capsules
Apache License 2.0
3.8k stars 1.16k forks source link

correct the softmax dimenstion from 3 to 2 #11

Closed 13331151 closed 6 years ago

naturomics commented 6 years ago

this is Eq. 3:tmp the sum operation is act on capsule j (k) . In my code, c_IJ has shape [1, 1, 1152, 10, 1], corresponding to [1, 1, num_caps_i, num_caps_j, 1]. So, I think that dim=3 is right

13331151 commented 6 years ago

Actually, this is from your code, you should better double-check it by you self.

                    b_IJ = tf.zeros(shape=[1, 1152, 10, 1, 1], dtype=np.float32)
                    capsules = routing(self.input, b_IJ)

assert c_IJ.get_shape() == [cfg.batch_size, 1152, 10, 1, 1]