Created
August 27, 2018 19:05
-
-
Save NMZivkovic/bd0a2388e2dc4df28e3a953f4c1b785b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Calculating BMU | |
input_matix = tf.stack([self._input for i in range(x*y)]) | |
distances = tf.sqrt(tf.reduce_sum(tf.pow(tf.subtract(self._weights, input_matix), 2), 1)) | |
bmu = tf.argmin(distances, 0) | |
#Get BMU location | |
mask = tf.pad(tf.reshape(bmu, [1]), np.array([[0, 1]])) | |
size = tf.cast(tf.constant(np.array([1, 2])), dtype=tf.int64) | |
bmu_location = tf.reshape(tf.slice(self._locations, mask, size), [2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment