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

Why num_outputs is mandatory? #15

Closed thibo73800 closed 6 years ago

thibo73800 commented 6 years ago

https://github.com/naturomics/CapsNet-Tensorflow/blob/1e0668037447e89aca9173a688ce1965bf6a43c1/capsNet.py#L45

Why num_outputs is set in this while it will not be used?

naturomics commented 6 years ago

@thibo73800 the 'num_outputs' para should be used in this line: b_IJ = tf.zeros(shape=[1, 1152, 10, 1, 1], dtype=np.float32) => b_IJ = tf.zeros(shape=[1, 1152, num_outputs, 1, 1], dtype=np.float32), which is designed for extensibility. Of course, the '1152' can also be automatically calculated (I would like to replace all of number with parameters, making the code can be reused in more scenarios)

thibo73800 commented 6 years ago

Ok, but the meaning of num_outputs is in fact, the number of capsules in the "Fc" CapsulesLayer?

Thank for your answer.

naturomics commented 6 years ago

@thibo73800 Yes, it is.