टेंसरफ़्लो :: ऑप्स :: डायनामिकस्टिच
#include <data_flow_ops.h>
data
टेनर्स से मानों को एकल टेंसर में इंटरलेव करें।
सारांश
एक मर्ज किए गए टेंसर को ऐसे बनाता है
merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...]
उदाहरण के लिए, यदि प्रत्येक indices[m]
अदिश या वेक्टर है, तो हमारे पास है
# Scalar indices: merged[indices[m], ...] = data[m][...]
# Vector indices: merged[indices[m][i], ...] = data[m][i, ...]
प्रत्येक data[i].shape
इसी के साथ प्रारंभ होना indices[i].shape
, और के बाकी data[i].shape
निरंतर होना चाहिए wrt i
। अर्थात्, हमारे पास data[i].shape = indices[i].shape + constant
। इस constant
संदर्भ में, आउटपुट आकार
merged.shape = [max(indices)] + constantहै
मानों को क्रम में विलय कर दिया जाता है, इसलिए यदि कोई सूचकांक दोनों indices[m][i]
और indices[n][j]
में दिखाई देता है indices[n][j]
लिए (m,i) < (n,j)
टुकड़ा data[n][j]
मर्ज किए गए परिणाम में दिखाई देते हैं। यदि आपको इस गारंटी की आवश्यकता नहीं है, तो ParallelDynamicStitch कुछ उपकरणों पर बेहतर प्रदर्शन कर सकता है।
उदाहरण के लिए:
indices[0] = 6 indices[1] = [4, 1] indices[2] = [[5, 2], [0, 3]] data[0] = [61, 62] data[1] = [[41, 42], [11, 12]] data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]] merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42], [51, 52], [61, 62]]
इस विधि के द्वारा बनाई गई मर्ज विभाजन करने के लिए इस्तेमाल किया जा सकता dynamic_partition
जैसा कि निम्न उदाहरण पर सचित्र:
# Apply function (increments x_i) on elements for which a certain condition # apply (x_i != -1 in this example). x=tf.constant([0.1, -1., 5.2, 4.3, -1., 7.4]) condition_mask=tf.not_equal(x,tf.constant(-1.)) partitioned_data = tf.dynamic_partition( x, tf.cast(condition_mask, tf.int32) , 2) partitioned_data[1] = partitioned_data[1] + 1.0 condition_indices = tf.dynamic_partition( tf.range(tf.shape(x)[0]), tf.cast(condition_mask, tf.int32) , 2) x = tf.dynamic_stitch(condition_indices, partitioned_data) # Here x=[1.1, -1., 6.2, 5.3, -1, 8.4], the -1. values remain # unchanged.
तर्क:
- गुंजाइश: एक स्कोप ऑब्जेक्ट
रिटर्न:
-
Output
: मर्ज किए गए टेंसर।
कंस्ट्रक्टर और डिस्ट्रक्टर्स | |
---|---|
DynamicStitch (const :: tensorflow::Scope & scope, :: tensorflow::InputList indices, :: tensorflow::InputList data) |
सार्वजनिक विशेषताएँ | |
---|---|
merged | |
operation |
सार्वजनिक कार्य | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
सार्वजनिक विशेषताएँ
विलय होना
::tensorflow::Output merged
ऑपरेशन
Operation operation
सार्वजनिक कार्य
डायनामिकस्टिच
061924bbb0नोड
::tensorflow::Node * node() const
ऑपरेटर :: टेंसरफ़्लो :: इनपुट
operator::tensorflow::Input() constहै
ऑपरेटर :: टेंसोफ़्लो :: आउटपुट
operator::tensorflow::Output() const