टेंसरफ़्लो :: ऑप्स :: MatrixSetDiagV2
#include <array_ops.h>
नए बैच वाले विकर्ण मूल्यों के साथ एक बैच मैट्रिक्स मैट्रिक्स को लौटाता है।
सारांश
input
और diagonal
को देखते हुए, यह ऑपरेशन एक ही आकार और मान के साथ एक टेंसर देता है, जो अंतरतम मैट्रिसेस के निर्दिष्ट विकर्णों को छोड़कर input
रूप में है। ये diagonal
में मूल्यों द्वारा अधिलेखित हो जाएंगे।
input
में r+1
आयाम [I, J, ..., L, M, N]
। जब k
स्केलर या k[0] == k[1]
, तो diagonal
के r
आयाम हैं [I, J, ..., L, max_diag_len]
। अन्यथा, इसमें r+1
आयाम [I, J, ..., L, num_diags, max_diag_len]
। num_diags
विकर्णों की संख्या है, num_diags = k[1] - k[0] + 1
। max_diag_len
रेंज में सबसे लंबा विकर्ण है [k[0], k[1]]
, max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0))
आउटपुट आयाम [I, J, ..., L, M, N]
साथ रैंक k+1
का एक टेंसर है। यदि k
स्केलर या k[0] == k[1]
:
output[i, j, ..., l, m, n] = diagonal[i, j, ..., l, n-max(k[1], 0)] ; if n - m == k[1] output[i, j, ..., l, m, n] ; otherwise
अन्यथा,
output[i, j, ..., l, m, n] = diagonal[i, j, ..., l, k[1]-d, n-max(d, 0)] ; if d_lower <= d <= d_upper input[i, j, ..., l, m, n] ; otherwiseजहाँ
d = n - m
उदाहरण के लिए:
0bb8181b00
# A superdiagonal (per batch). tf.matrix_diag(diagonal, k = 1) ==> [[[7, 1, 7, 7], # Output shape: (2, 3, 4) [7, 7, 2, 7], [7, 7, 7, 3]], [[7, 4, 7, 7], [7, 7, 5, 7], [7, 7, 7, 6]]]
# A band of diagonals. diagonals = np.array([[[1, 2, 3], # Diagonal shape: (2, 2, 3) [4, 5, 0]], [[6, 1, 2], [3, 4, 0]]]) tf.matrix_diag(diagonals, k = (-1, 0)) ==> [[[1, 7, 7, 7], # Output shape: (2, 3, 4) [4, 2, 7, 7], [0, 5, 3, 7]], [[6, 7, 7, 7], [3, 1, 7, 7], [7, 4, 2, 7]]]
Arguments:
- scope: A Scope object
- input: Rank
r+1
, wherer >= 1
. - diagonal: Rank
r
whenk
is an integer ork[0] == k[1]
. Otherwise, it has rankr+1
.k >= 1
. - k: Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main diagonal, and negative value means subdiagonals.
k
can be a single integer (for a single diagonal) or a pair of integers specifying the low and high ends of a matrix band.k[0]
must not be larger thank[1]
.
Returns:
Output
: Rankr+1
, withoutput.shape = input.shape
.
Constructors and Destructors |
|
---|---|
MatrixSetDiagV2(const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input diagonal, ::tensorflow::Input k)
|
Public attributes |
|
---|---|
operation
|
|
output
|
Public functions |
|
---|---|
node() const
|
::tensorflow::Node *
|
operator::tensorflow::Input() const
|
|
operator::tensorflow::Output() const
|
|
Public attributes
operation
Operation operation
उत्पादन
::tensorflow::Output output
सार्वजनिक कार्य
MatrixSetDiagV2
MatrixSetDiagV2( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input diagonal, ::tensorflow::Input k )
नोड
::tensorflow::Node * node() const
ऑपरेटर :: टेंसरफ़्लो :: इनपुट
operator::tensorflow::Input() constहै
ऑपरेटर :: टेंसरफ़्लो :: आउटपुट
operator::tensorflow::Output() const