Created
November 7, 2017 18:35
-
-
Save akashgit/c7ccba789623429589a58f628a0e4c78 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
def ring(batchsize, num_cluster=8, scale=1, std=.01,**kwargs): | |
pi_= tf.constant(np.pi) | |
rand_indices = tf.random_uniform([batchsize], minval=0, maxval=num_cluster, dtype=tf.int32) | |
base_angle = pi_ * 2 / num_cluster | |
angle = (base_angle * tf.cast(rand_indices,dtype=float32)) - (pi_ / 2) | |
mean_0 = tf.expand_dims(scale*tf.cos(angle),1) | |
mean_1 = tf.expand_dims(scale*tf.sin(angle),1) | |
mean = tf.concat([mean_0, mean_1], 1) | |
return ds.Normal(mean, (std**2)*tf.ones_like(mean)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment