텐서플로우:: 작전:: MatrixDiagPartV2

#include <array_ops.h>

배치 텐서의 배치 대각선 부분을 반환합니다.

요약

일괄 처리된 inputk[0] 번째 대각선부터 k[1] 번째 대각선까지의 텐서를 반환합니다.

input r 차원 [I, J, ..., L, M, N] 이 있다고 가정합니다. max_diag_len 추출할 모든 대각선 중 최대 길이로 설정하고, max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0)) num_diags 추출할 대각선의 개수로 설정합니다. 추출, num_diags = k[1] - k[0] + 1 .

num_diags == 1 이면 출력 텐서는 [I, J, ..., L, max_diag_len] 모양과 값을 갖는 r - 1 순위입니다.

diagonal[i, j, ..., l, n]
 
= input[i, j, ..., l, n+y, n+x] ; when 0 <= n-y < M and 0 <= n-x < N,
   
0                             ; otherwise.
여기서 y = max(-k[1], 0) , x = max(k[1], 0) .

그렇지 않은 경우 출력 텐서는 차원 [I, J, ..., L, num_diags, max_diag_len] 과 값이 있는 r 순위를 갖습니다.

diagonal[i, j, ..., l, m, n]
 
= input[i, j, ..., l, n+y, n+x] ; when 0 <= n-y < M and 0 <= n-x < N,
   
0                             ; otherwise.
여기서 d = k[1] - m , y = max(-d, 0)x = max(d, 0) .

입력은 최소한 행렬이어야 합니다.

예를 들어:

input = np.array([[[1, 2, 3, 4],  # Input shape: (2, 3, 4)
                   
[5, 6, 7, 8],
                   
[9, 8, 7, 6]],
                 
[[5, 4, 3, 2],
                   
[1, 2, 3, 4],
                   
[5, 6, 7, 8]]])

# A main diagonal from each batch.
tf
.matrix_diag_part(input) ==> [[1, 6, 7],  # Output shape: (2, 3)
                               
[5, 2, 7]]

# A superdiagonal from each batch.
tf
.matrix_diag_part(input, k = 1)
 
==> [[2, 7, 6],  # Output shape: (2, 3)
       
[4, 3, 8]]

# A tridiagonal band from each batch.
tf
.matrix_diag_part(input, k = (-1, 1))
 
==> [[[2, 7, 6],  # Output shape: (2, 3, 3)
       
[1, 6, 7],
       
[5, 8, 0]],
       
[[4, 3, 8],
       
[5, 2, 7],
       
[1, 6, 0]]]

# Padding = 9
tf
.matrix_diag_part(input, k = (1, 3), padding = 9)
 
==> [[[4, 9, 9],  # Output shape: (2, 3, 3)
       
[3, 8, 9],
       
[2, 7, 6]],
       
[[2, 9, 9],
       
[3, 4, 9],
       
[4, 3, 8]]]

인수:

  • 범위: 범위 개체
  • 입력: r >= 2r 텐서 순위.
  • k: 대각선 오프셋. 양수 값은 상부 대각선, 0은 주 대각선, 음수 값은 하부 대각선을 의미합니다. k 단일 정수(단일 대각선에 대한)이거나 행렬 대역의 낮은 끝과 높은 끝을 지정하는 정수 쌍일 수 있습니다. k[0] k[1] 보다 클 수 없습니다.
  • padding_value : 지정된 대각선 바깥 부분을 채울 값입니다. 기본값은 0입니다.

보고:

  • Output : 추출된 대각선입니다.

생성자와 소멸자

MatrixDiagPartV2 (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input k, :: tensorflow::Input padding_value)

공공 기능

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

공개 속성

대각선

::tensorflow::Output diagonal

작업

Operation operation

공공 기능

MatrixDiagPartV2

 MatrixDiagPartV2(
 
const ::tensorflow::Scope & scope,
 
::tensorflow::Input input,
 
::tensorflow::Input k,
 
::tensorflow::Input padding_value
)

마디

::tensorflow::Node * node() const 

연산자::텐서플로우::입력

 operator::tensorflow::Input() const 

연산자::텐서플로우::출력

 operator::tensorflow::Output() const