tensorflow :: opérations :: MatrixDiagPartV2
#include <array_ops.h>
Renvoie la partie diagonale groupée d'un tenseur groupé.
Résumé
Renvoie un tenseur avec les diagonales k[0]
-th à k[1]
-th de l' input
groupée.
Supposons que l' input
a r
dimensions [I, J, ..., L, M, N]
. Soit max_diag_len
la longueur maximale parmi toutes les diagonales à extraire, max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0))
Soit num_diags
le nombre de diagonales à extraire, num_diags = k[1] - k[0] + 1
.
Si num_diags == 1
, le tenseur de sortie est de rang r - 1
avec forme [I, J, ..., L, max_diag_len]
et valeurs:
diagonal[i, j, ..., l, n] = input[i, j, ..., l, n+y, n+x] ; when 0 <= n-y < M and 0 <= n-x < N, 0 ; otherwise.où
y = max(-k[1], 0)
, x = max(k[1], 0)
. Sinon, le tenseur de sortie est de rang r
avec des dimensions [I, J, ..., L, num_diags, max_diag_len]
avec des valeurs:
diagonal[i, j, ..., l, m, n] = input[i, j, ..., l, n+y, n+x] ; when 0 <= n-y < M and 0 <= n-x < N, 0 ; otherwise.où
d = k[1] - m
, y = max(-d, 0)
et x = max(d, 0)
.L'entrée doit être au moins une matrice.
Par example:
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 = 9 tf.matrix_diag_part(input, k = (1, 3), padding = 9) ==> [[[4, 9, 9], # Output shape: (2, 3, 3) [3, 8, 9], [2, 7, 6]], [[2, 9, 9], [3, 4, 9], [4, 3, 8]]]
Arguments:
- scope: un objet Scope
- input: Tenseur de rang
r
oùr >= 2
. - k: Décalage (s) diagonal (s). Une valeur positive signifie superdiagonale, 0 fait référence à la diagonale principale et une valeur négative signifie des sous-diagonales.
k
peut être un seul entier (pour une seule diagonale) ou une paire d'entiers spécifiant les extrémités basse et haute d'une bande matricielle.k[0]
ne doit pas être supérieur àk[1]
. - padding_value: valeur avec laquelle remplir la zone en dehors de la bande diagonale spécifiée. La valeur par défaut est 0.
Retour:
-
Output
: la ou les diagonales extraites.
Constructeurs et destructeurs | |
---|---|
MatrixDiagPartV2 (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input k, :: tensorflow::Input padding_value) |
Attributs publics | |
---|---|
diagonal | |
operation |
Fonctions publiques | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Attributs publics
diagonale
::tensorflow::Output diagonal
opération
Operation operation
Fonctions publiques
MatrixDiagPartV2
MatrixDiagPartV2( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input k, ::tensorflow::Input padding_value )
nœud
::tensorflow::Node * node() const
operator :: tensorflow :: Input
operator::tensorflow::Input() const
operator :: tensorflow :: Output
operator::tensorflow::Output() const