2017-02-16 2 views
0

I 이렇게 Tensorflow 조작을 사용 대칭 퇴 플리츠 행렬로 벡터 변환하고자 :TensorFlow에서 Toeplitz 행렬로 벡터를 변환하는 가장 간단한 방법은 무엇입니까?

a = tf.placeholder(tf.float32, shape=[vector_size]) 
A = some_tensorflow_operation(a) 

(A)의 형상 [vector_size, vector_size]이다. 두 변수의 관계는 다음과 같습니다.

a = [a1,a2,a3] 
A = [[a1,a2,a3],[a2,a1,a2],[a3,a2,a1]] 

을 할 수있는 가장 간단한 방법은 무엇입니까?

답변

0

vector_size=3 경우 :

>>> a = tf.placeholder(tf.float32, shape=[vector_size]) 
>>> A = [[a[0],a[1],a[2]],[a[1],a[0],a[1]],[a[2],a[1],a[0]]] 
>>> sess = tf.Session() 
>>> sess.run(A, {a: [1, 2, 3]}) 
[[1.0, 2.0, 3.0], [2.0, 1.0, 2.0], [3.0, 2.0, 1.0]] 
관련 문제