זרימת טנסור :: אופ :: MatrixBandPart

#include <array_ops.h>

העתק טנזור הגדרת הכל מחוץ ללהקה מרכזית בכל מטריצה ​​פנימית.

סיכום

לאפס.

band חלק מחושב כדלקמן: נניח input יש k ממדים [I, J, K, ..., M, N] , אז הפלט הוא מותח עם אותה הצורה שבה

band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n] .

פונקציית המחוון

in_band(m, n) = (num_lower < 0 || (mn) <= num_lower)) && (num_upper < 0 || (nm) <= num_upper) .

לדוגמה:

# if 'input' is [[ 0,  1,  2, 3]
                 [-1,  0,  1, 2]
                 [-2, -1,  0, 1]
                 [-3, -2, -1, 0]],

tf.matrix_band_part(input, 1, -1) ==> [[ 0,  1,  2, 3]
                                       [-1,  0,  1, 2]
                                       [ 0, -1,  0, 1]
                                       [ 0,  0, -1, 0]],

tf.matrix_band_part(input, 2, 1) ==> [[ 0,  1,  0, 0]
                                      [-1,  0,  1, 0]
                                      [-2, -1,  0, 1]
                                      [ 0, -2, -1, 0]]

מקרים מיוחדים שימושיים:

 tf.matrix_band_part(input, 0, -1) ==> Upper triangular part.
 tf.matrix_band_part(input, -1, 0) ==> Lower triangular part.
 tf.matrix_band_part(input, 0, 0) ==> Diagonal.

טענות:

  • היקף: אובייקט Scope
  • קלט: דרגה k טנזור.
  • מספר_נמוך: טנסור 0-D. מספר תת-אלכסונים שיש לשמור. אם שלילי, שמור על המשולש התחתון כולו.
  • num_upper: טנסור 0-D. מספר האלכסונים שיש לשמור. אם שלילי, שמור על המשולש העליון כולו.

החזרות:

  • Output : דירוג k טנסור מאותה צורה כמו קלט. הטנזור המחולץ.

בונים והרסנים

MatrixBandPart (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input num_lower, :: tensorflow::Input num_upper)

תכונות ציבוריות

band
operation

פונקציות ציבוריות

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

תכונות ציבוריות

לְהִתְאַגֵד

::tensorflow::Output band

מבצע

Operation operation

פונקציות ציבוריות

MatrixBandPart

 MatrixBandPart(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input num_lower,
  ::tensorflow::Input num_upper
)

צוֹמֶת

::tensorflow::Node * node() const 

אופרטור :: זרימת טנסור :: קלט

 operator::tensorflow::Input() const 

אופרטור :: זרימת טנסור :: פלט

 operator::tensorflow::Output() const