텐서플로우:: 작전:: MatrixSetDiagV2
#include <array_ops.h>새로운 배치 대각선 값을 갖는 배치 행렬 텐서를 반환합니다.
요약
input 및 diagonal 주어지면 이 연산은 가장 안쪽 행렬의 지정된 대각선을 제외하고 input 과 동일한 모양 및 값을 가진 텐서를 반환합니다. 이는 diagonal 값으로 덮어쓰여집니다.
input r+1 차원 [I, J, ..., L, M, N] 이 있습니다. k 가 스칼라이거나 k[0] == k[1] 인 경우 diagonal r 차원 [I, J, ..., L, max_diag_len] 을 갖습니다. 그렇지 않으면 r+1 차원 [I, J, ..., L, num_diags, max_diag_len] 을 갖습니다. num_diags 는 대각선 수입니다. num_diags = k[1] - k[0] + 1 . max_diag_len [k[0], k[1]] 범위에서 가장 긴 대각선입니다 max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0))
출력은 [I, J, ..., L, M, N] 차원을 갖는 k+1 순위의 텐서입니다. k 가 스칼라이거나 k[0] == k[1] 인 경우:
output[i, j, ..., l, m, n]
= diagonal[i, j, ..., l, n-max(k[1], 0)] ; if n - m == k[1]
output[i, j, ..., l, m, n] ; otherwise그렇지 않으면,
output[i, j, ..., l, m, n]
= diagonal[i, j, ..., l, k[1]-d, n-max(d, 0)] ; if d_lower <= d <= d_upper
input[i, j, ..., l, m, n] ; otherwised = n - m예를 들어:
# The main diagonal. input = np.array([[[7, 7, 7, 7], # Input shape: (2, 3, 4) [7, 7, 7, 7], [7, 7, 7, 7]], [[7, 7, 7, 7], [7, 7, 7, 7], [7, 7, 7, 7]]]) diagonal = np.array([[1, 2, 3], # Diagonal shape: (2, 3) [4, 5, 6]]) tf.matrix_diag(diagonal) ==> [[[1, 7, 7, 7], # Output shape: (2, 3, 4) [7, 2, 7, 7], [7, 7, 3, 7]], [[4, 7, 7, 7], [7, 5, 7, 7], [7, 7, 6, 7]]]
# A superdiagonal (per batch). tf.matrix_diag(diagonal, k = 1) ==> [[[7, 1, 7, 7], # Output shape: (2, 3, 4) [7, 7, 2, 7], [7, 7, 7, 3]], [[7, 4, 7, 7], [7, 7, 5, 7], [7, 7, 7, 6]]]
# A band of diagonals.
diagonals = np.array([[[1, 2, 3], # Diagonal shape: (2, 2, 3)
[4, 5, 0]],
[[6, 1, 2],
[3, 4, 0]]])
tf.matrix_diag(diagonals, k = (-1, 0))
==> [[[1, 7, 7, 7], # Output shape: (2, 3, 4)
[4, 2, 7, 7],
[0, 5, 3, 7]],
[[6, 7, 7, 7],
[3, 1, 7, 7],
[7, 4, 2, 7]]]Arguments:
- scope: A Scope object
- input: Rank
r+1, wherer >= 1. - diagonal: Rank
rwhenkis an integer ork[0] == k[1]. Otherwise, it has rankr+1.k >= 1. - k: Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main diagonal, and negative value means subdiagonals.
kcan be a single integer (for a single diagonal) or a pair of integers specifying the low and high ends of a matrix band.k[0]must not be larger thank[1].
Returns:
Output: Rankr+1, withoutput.shape = input.shape.
Constructors and Destructors |
|
|---|---|
MatrixSetDiagV2(const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input diagonal, ::tensorflow::Input k)
|
Public attributes |
|
|---|---|
operation
|
|
output
|
|
Public functions |
|
|---|---|
node() const
|
::tensorflow::Node *
|
operator::tensorflow::Input() const
|
|
operator::tensorflow::Output() const
|
|
Public attributes
산출
::tensorflow::Output output
공공 기능
MatrixSetDiagV2
MatrixSetDiagV2( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input diagonal, ::tensorflow::Input k )
마디
::tensorflow::Node * node() const
연산자::텐서플로우::입력
operator::tensorflow::Input() const
연산자::텐서플로우::출력
operator::tensorflow::Output() const