Tensorflow symmetric matrix
You can use tf.matrix_band_part(input, 0, -1)
to create an upper triangular matrix from a square one, so this code would allow you to train on n(n+1)/2
variables although it has you create n*n
:
X = tf.Variable(tf.random_uniform([d,d], minval=-.1, maxval=.1, dtype=tf.float64))
X_upper = tf.matrix_band_part(X, 0, -1)
X_symm = 0.5 * (X_upper + tf.transpose(X_upper))