Understanding issues of custom layer- "ClusteringLayer"
Thank you for sharing the code. I am new in Keras. I know it is a stupid idea to ask this bellow question. In ClusteringLayer, the encoder.output shpae is (?,10) which has been passed through the custom layer. When I pass the encoder.output weights to the custom layer "Bulid function", it generates weights for self.clustering by the size of(10,10) i.e the n_clusters is 10 and input_shape[1] is 10. Is it so? or I am missing something. In "Call function", specifically in this line, q = 1.0 / (1.0 + (K.sum(K.square(K.expand_dims(inputs, axis=1) - self.clusters), axis=2) / self.alpha)), why do you use K.expand_dims? What is the purpose of using this?
Please help me to figure out these two problems. Again thank you for sharing the beautiful code.