टेंसरफ़्लो :: ऑप्स :: इकट्ठा करो
#include <array_ops.h>
इकट्ठा से स्लाइस params
एक में टेन्सर द्वारा निर्दिष्ट आकार के साथ indices
।
सारांश
indices
एक K-आयामी पूर्णांक टेन्सर, का सबसे अच्छा सोचा है में सूचकांक के एक (K-1) आयामी टेन्सर के रूप में params
, जहां प्रत्येक तत्व का एक टुकड़ा को परिभाषित करता है params
:
output[\\(i_0, ..., i_{K-2}\\)] = params[indices[\\(i_0, ..., i_{K-2}\\)]]
जबकि में tf.gather
indices
परिभाषित करता है की पहली आयाम में स्लाइस params
, में tf.gather_nd
, indices
पहली में परिभाषित करता है स्लाइस N
के आयाम params
, जहां N = indices.shape[-1]
।
के अंतिम आयाम indices
अधिकतम होनी चाहिए के पद params
:
indices.shape[-1] <= params.rank
के अंतिम आयाम indices
तत्वों से मेल खाती है (यदि indices.shape[-1] == params.rank
) या स्लाइस (यदि indices.shape[-1] < params.rank
) आयाम में indices.shape[-1]
का params
। आउटपुट टेंसर का आकार
indices.shape[:-1] + params.shape[indices.shape[-1]:]है
ध्यान दें कि सीपीयू पर, यदि कोई बाध्य सूचकांक पाया जाता है, तो एक त्रुटि वापस आ जाती है। जीपीयू पर, यदि बाउंड इंडेक्स से बाहर पाया जाता है, तो एक 0 को संबंधित आउटपुट मूल्य में संग्रहीत किया जाता है।
नीचे कुछ उदाहरण।
एक मैट्रिक्स में सरल अनुक्रमण:
indices = [[0, 0], [1, 1]] params = [['a', 'b'], ['c', 'd']] output = ['a', 'd']
एक मैट्रिक्स में टुकड़ा अनुक्रमण:
indices = [[1], [0]] params = [['a', 'b'], ['c', 'd']] output = [['c', 'd'], ['a', 'b']]
3-टेंसर में अनुक्रमण:
indices = [[1]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = [[['a1', 'b1'], ['c1', 'd1']]]
indices = [[0, 1], [1, 0]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = [['c0', 'd0'], ['a1', 'b1']]
indices = [[0, 0, 1], [1, 0, 1]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = ['b0', 'b1']
मैट्रिक्स में बैच किया गया अनुक्रमण:
indices = [[[0, 0]], [[0, 1]]] params = [['a', 'b'], ['c', 'd']] output = [['a'], ['b']]
एक मैट्रिक्स में बैच किए गए स्लाइस इंडेक्सिंग:
09 बी 137 बी 750
3-टेंसर में बैचिंग इंडेक्सिंग:
indices = [[[1]], [[0]]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = [[[['a1', 'b1'], ['c1', 'd1']]], [[['a0', 'b0'], ['c0', 'd0']]]]
indices = [[[0, 1], [1, 0]], [[0, 0], [1, 1]]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = [[['c0', 'd0'], ['a1', 'b1']], [['a0', 'b0'], ['c1', 'd1']]]
indices = [[[0, 0, 1], [1, 0, 1]], [[0, 1, 1], [1, 1, 0]]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = [['b0', 'b1'], ['d0', 'c1']]
tf.gather
और tf.batch_gather
भी देखें।
तर्क:
- गुंजाइश: एक स्कोप ऑब्जेक्ट
- params: मूल्यों को इकट्ठा करने के लिए टेंसर।
- सूचकांक: इंडेक्स टेंसर।
रिटर्न:
-
Output
: से मानparams
द्वारा दिए गए सूचकांक से इकट्ठाindices
, आकार के साथindices.shape[:-1] + params.shape[indices.shape[-1]:]
।
कंस्ट्रक्टर और डिस्ट्रक्टर्स | |
---|---|
GatherNd (const :: tensorflow::Scope & scope, :: tensorflow::Input params, :: tensorflow::Input indices) |
सार्वजनिक विशेषताएँ | |
---|---|
operation | |
output |
सार्वजनिक कार्य | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
सार्वजनिक विशेषताएँ
ऑपरेशन
Operation operation
उत्पादन
::tensorflow::Output output
सार्वजनिक कार्य
इकट्ठा करो
GatherNd( const ::tensorflow::Scope & scope, ::tensorflow::Input params, ::tensorflow::Input indices )
नोड
::tensorflow::Node * node() const
ऑपरेटर :: टेंसरफ़्लो :: इनपुट
operator::tensorflow::Input() constहै
ऑपरेटर :: टेंसोफ़्लो :: आउटपुट
operator::tensorflow::Output() const