-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
There seems to be a problem in V_k when calculating the loss in the function.
in capsNet.py at loss function (line 106?)
max_l = tf.square(tf.maximum(0., cfg.m_plus - self.v_length))
max_r = tf.square(tf.maximum(0., self.v_length - cfg.m_minus))
you use self.v_length when calculating max_l and max_r.
self.v_length = tf.sqrt(reduce_sum(tf.square(self.caps2),
axis=2, keepdims=True) + epsilon)
self.caps2 is V_J and V_J's Dim is [batch_size, 10, 16, 1]
V_J = squash(S_J), so all of value in V_J is (-1, 1)
if it calculate self.v_length, the dim of self.v_length is [batch_size, 10, 1, 1] and interval of value is (-4, 4)
so i think, it has to change like this
max_l = tf.square(tf.maximum(0., cfg.m_plus - (self.v_length)/4))
max_r = tf.square(tf.maximum(0., (self.v_length)/4 - cfg.m_minus))
if it is wrong, Can you tell me what 's wrong?