naturomics / CapsNet-Tensorflow

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

will the norm in squash func be a scalar #40

Closed vpegasus closed 6 years ago

vpegasus commented 6 years ago

Hi, good job ! I have a small question that: in the squash func, you keep the dims of norm('vec_squared_norm') as that of the 'vector', I wonder why not collapse its dims to [batch_size,1] ? From where I stand, the norm should be a scalar. e.g.: x= [a,b,c,d] ||x||^2 = norm(x)^2 = (|a|^2+|b|^2+|c|^2+|d|^2)

thus x --> norm(x)^2 : [batch_size, 1, num_caps, vec_len, 1] --> [batch_size, 1] ?

naturomics commented 6 years ago

Just for the convenience of computing