2
(N,2,2)
의 2D 회전 행렬로 R
이 있습니다. 이제 각각의 행렬을 (3,3)
차원 회전 행렬로 확장하여 각 [:,:2,:2]
에 0을 넣고 1
을 [:,2,2]
에 입력하고 싶습니다.메인 대각선과 제로에서 하나씩 복수의 텐서를 패딩하는 방법은 무엇입니까?
tensorflow에서 이것을 수행하는 방법은 무엇입니까?
UPDATE concat
은 방송하지 않기 때문에 나는이 방법
R = tf.get_variable(name='R', shape=np.shape(R_value), dtype=tf.float64,
initializer=tf.constant_initializer(R_value))
eye = tf.eye(np.shape(R_value)[1]+1)
right_column = eye[:2,2]
bottom_row = eye[2,:]
R = tf.concat([R, right_column], 3)
R = tf.concat([R, bottom_row], 2)
을 시도했지만 실패
...
업데이트 2
내가 명시 적으로 만든 방송 및 잘못된 고정 색인도 concat
전화 :
R = tf.get_variable(name='R', shape=np.shape(R_value), dtype=tf.float64,
initializer=tf.constant_initializer(R_value))
eye = tf.eye(np.shape(R_value)[1]+1, dtype=tf.float64)
right_column = eye[:2,2]
right_column = tf.expand_dims(right_column, 0)
right_column = tf.expand_dims(right_column, 2)
right_column = tf.tile(right_column, (np.shape(R_value)[0], 1, 1))
bottom_row = eye[2,:]
bottom_row = tf.expand_dims(bottom_row, 0)
bottom_row = tf.expand_dims(bottom_row, 0)
bottom_row = tf.tile(bottom_row, (np.shape(R_value)[0], 1, 1))
R = tf.concat([R, right_column], 2)
R = tf.concat([R, bottom_row], 1)
솔루션이 다소 복잡해 보입니다. 더 간단한 것이 있습니까? [N, 2, 2]
에