tensorflow::ops::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 || (m-n) <= num_lower)) && (num_upper < 0 || (n-m) <= num_upper).
Например:
# if 'input' is [[ 0, 1, 2, 3] # [-1, 0, 1, 2] # [-2, -1, 0, 1] # [-3, -2, -1, 0]],
tf.linalg.band_part(input, 1, -1) ==> [[ 0, 1, 2, 3]
[-1, 0, 1, 2]
[ 0, -1, 0, 1]
[ 0, 0, -1, 0]],tf.linalg.band_part(input, 2, 1) ==> [[ 0, 1, 0, 0]
[-1, 0, 1, 0]
[-2, -1, 0, 1]
[ 0, -2, -1, 0]]Полезные частные случаи:
tf.linalg.band_part(input, 0, -1) ==> Upper triangular part. tf.linalg.band_part(input, -1, 0) ==> Lower triangular part. tf.linalg.band_part(input, 0, 0) ==> Diagonal.
Аргументы:
- scope: объект Scope
- input: тензор ранга
k. - num_lower: тензор размерности 0. Количество сохраняемых поддиагоналей. Если значение отрицательное, сохраняется вся нижняя треугольная часть.
- num_upper: тензор размерности 0. Количество сохраняемых наддиагоналей. Если значение отрицательное, сохраняется вся верхняя треугольная часть.
Возвращает:
-
Output: тензор рангаkтой же формы, что и input. Извлеченный ленточный тензор.
| Конструкторы и деструкторы | |
|---|---|
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 | |
Открытые атрибуты
band
::tensorflow::Output band
operation
Operation operation
Открытые функции
MatrixBandPart
MatrixBandPart( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input num_lower, ::tensorflow::Input num_upper )
node
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/matrix-band-part