टेंसरफ़्लो:: ऑप्स:: समानांतर गतिशील सिलाई

#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[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 : मर्ज किया गया टेंसर।

निर्माता और विध्वंसक

ParallelDynamicStitch (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

सार्वजनिक समारोह

समानांतर गतिशील सिलाई

 ParallelDynamicStitch(
  const ::tensorflow::Scope & scope,
  ::tensorflow::InputList indices,
  ::tensorflow::InputList data
)

नोड

::tensorflow::Node * node() const 

ऑपरेटर::टेन्सरफ़्लो::इनपुट

 operator::tensorflow::Input() const 

ऑपरेटर::टेन्सरफ़्लो::आउटपुट

 operator::tensorflow::Output() const