Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
flux tensoriel : : opérations : : MatrixBandPart
#include <array_ops.h>
Copiez un tenseur définissant tout ce qui se trouve en dehors d'une bande centrale dans chaque matrice la plus interne.
Résumé
à zéro.
La partie band
est calculée comme suit : Supposons que input
ait k
dimensions [I, J, K, ..., M, N]
, alors la sortie est un tenseur de même forme où
band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]
.
La fonction indicateur
in_band(m, n) = (num_lower < 0 || (mn) <= num_lower)) && (num_upper < 0 || (nm) <= num_upper)
.
Par exemple:
# 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]]
Cas particuliers utiles :
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.
Arguments :
- scope : un objet Scope
- entrée : Tenseur de rang
k
. - num_lower : tenseur 0-D. Nombre de sous-diagonales à conserver. Si négatif, conservez tout le triangle inférieur.
- num_upper : tenseur 0-D. Nombre de superdiagonales à conserver. Si négatif, conservez tout le triangle supérieur.
Retours :
-
Output
: Tenseur de rang k
de la même forme que l'entrée. Le tenseur bandes extrait.
Attributs publics
Fonctions publiques
nœud
::tensorflow::Node * node() const
operator::tensorflow::Input() const
opérateur :: tensorflow :: Sortie
operator::tensorflow::Output() const
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 2025/07/26 (UTC)."],[],[],null,["# tensorflow::ops::MatrixBandPart Class Reference\n\ntensorflow::ops::MatrixBandPart\n===============================\n\n`#include \u003carray_ops.h\u003e`\n\nCopy a tensor setting everything outside a central band in each innermost matrix.\n\nSummary\n-------\n\nto zero.\n\nThe `band` part is computed as follows: Assume `input` has `k` dimensions `[I, J, K, ..., M, N]`, then the output is a tensor with the same shape where\n\n`band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]`.\n\nThe indicator function\n\n`in_band(m, n) = (num_lower \u003c 0 || (m-n) \u003c= num_lower)) && (num_upper \u003c 0 || (n-m) \u003c= num_upper)`.\n\nFor example:\n\n\n```text\n# if 'input' is [[ 0, 1, 2, 3]\n [-1, 0, 1, 2]\n [-2, -1, 0, 1]\n [-3, -2, -1, 0]],\n```\n\n\u003cbr /\u003e\n\n\n```scdoc\ntf.matrix_band_part(input, 1, -1) ==\u003e [[ 0, 1, 2, 3]\n [-1, 0, 1, 2]\n [ 0, -1, 0, 1]\n [ 0, 0, -1, 0]],\n```\n\n\u003cbr /\u003e\n\n\n```scdoc\ntf.matrix_band_part(input, 2, 1) ==\u003e [[ 0, 1, 0, 0]\n [-1, 0, 1, 0]\n [-2, -1, 0, 1]\n [ 0, -2, -1, 0]]\n```\n\n\u003cbr /\u003e\n\nUseful special cases:\n\n\n```scdoc\n tf.matrix_band_part(input, 0, -1) ==\u003e Upper triangular part.\n tf.matrix_band_part(input, -1, 0) ==\u003e Lower triangular part.\n tf.matrix_band_part(input, 0, 0) ==\u003e Diagonal.\n```\n\n\u003cbr /\u003e\n\nArguments:\n\n- scope: A [Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: Rank `k` tensor.\n- num_lower: 0-D tensor. Number of subdiagonals to keep. If negative, keep entire lower triangle.\n- num_upper: 0-D tensor. Number of superdiagonals to keep. If negative, keep entire upper triangle.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): Rank `k` tensor of the same shape as input. The extracted banded tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [MatrixBandPart](#classtensorflow_1_1ops_1_1_matrix_band_part_1aafbd4f5790f99aabe649a2603fab5026)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` num_lower, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` num_upper)` ||\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [band](#classtensorflow_1_1ops_1_1_matrix_band_part_1a19ddd7640d84cfeb55298dcd2d150a8c) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_matrix_band_part_1a7f11fcb9cf1a97f13cded627a9579305) | [Operation](/versions/r2.1/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\n| ### Public functions ||\n|----------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_matrix_band_part_1a7a9ecf47b2def85ed1a8e7ab08dfe008)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_matrix_band_part_1a1b6a750bbd105a89c4ef9a398ccf7cf1)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_matrix_band_part_1a2be19e72aeddcea40f0be7cc6d6fdf97)`() const ` | ` ` ` ` |\n\nPublic attributes\n-----------------\n\n### band\n\n```text\n::tensorflow::Output band\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\nPublic functions\n----------------\n\n### MatrixBandPart\n\n```gdscript\n MatrixBandPart(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input num_lower,\n ::tensorflow::Input num_upper\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n```"]]