tensorflow:: אופס:: MatrixDiagPartV2
#include <array_ops.h>
מחזירה את החלק האלכסוני המצטבר של טנזור אצווה.
תַקצִיר
מחזירה טנזור עם האלכסונים k[0]
-th עד k[1]
-th של input
המצטבר.
נניח 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
, טנסור הפלט הוא בדרגה r - 1
עם צורה [I, J, ..., L, max_diag_len]
וערכים:
diagonal[i, j, ..., l, n] = input[i, j, ..., l, n+y, n+x] ; if 0 <= n+y < M and 0 <= n+x < N, padding_value ; otherwise.
y = max(-k[1], 0)
, x = max(k[1], 0)
. אחרת, לטנזור הפלט יש דירוג r
עם מידות [I, J, ..., L, num_diags, max_diag_len]
עם ערכים:
diagonal[i, j, ..., l, m, n] = input[i, j, ..., l, n+y, n+x] ; if 0 <= n+y < M and 0 <= n+x < N, padding_value ; 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 value = 9 tf.matrix_diag_part(input, k = (1, 3), padding_value = 9) ==> [[[4, 9, 9], # Output shape: (2, 3, 3) [3, 8, 9], [2, 7, 6]], [[2, 9, 9], [3, 4, 9], [4, 3, 8]]]
טיעונים:
- scope: אובייקט Scope
- קלט: דירוג
r
tensor שבוr >= 2
. - 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
מפעיל::tensorflow::קלט
operator::tensorflow::Input() const
אופרטור::tensorflow::פלט
operator::tensorflow::Output() const