جریان تنسور:: عملیات:: 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: یک شی Scope
- ورودی: تانسور رتبه
k
. - num_lower: تانسور 0-D. تعداد قطرهای فرعی برای حفظ. اگر منفی بود، کل مثلث پایینی را نگه دارید.
- num_upper: تانسور 0-D. تعداد superdiagonals برای نگه داشتن. اگر منفی بود، کل مثلث بالایی را نگه دارید.
برمی گرداند:
-
Output
: رتبهk
تانسور به همان شکل ورودی. تانسور نواری استخراج شده
سازندگان و تخریب کنندگان | |
---|---|
MatrixBandPart (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input num_lower, :: tensorflow::Input num_upper) |
توابع عمومی | |
---|---|
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
عملگر::tensorflow::ورودی
operator::tensorflow::Input() const
عملگر::tensorflow::خروجی
operator::tensorflow::Output() const