def DizzyLayerV1(X, indices):
n = int(X.get_shape()[0])
n_prime = int(n*(n-1)/2)
thetas = tf.Variable(tf.random_uniform([n_prime, 1], 0, 2*math.pi), name="thetas")
X_split = [X[k, :] for k in range(n)]
for k in range(n_prime):
(a, b) = indices[k]
theta = thetas[k]
c = tf.cos(theta)
s = tf.sin(theta)
v_1 = c*X_split[a]+s*X_split[b]
v_2 = -s*X_split[a]+c*X_split[b]
X_split[a] = v_1
X_split[b] = v_2
out = tf.pack(X_split)
return out
评论列表
文章目录