tensorflow:: ops:: ParallelDynamicStitch

#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 חייב להיות קבוע מבחינת i . כלומר, עלינו לקבל data[i].shape = indices[i].shape + constant . במונחים של constant זה, צורת הפלט היא

merged.shape = [max(indices)] + constant

ניתן למזג ערכים במקביל, כך שאם אינדקס מופיע גם ב- indices[m][i] וגם indices[n][j] , התוצאה עשויה להיות לא חוקית. זה שונה מהאופרטור הרגיל של DynamicStitch שמגדיר את ההתנהגות במקרה זה.

לְדוּגמָה:

    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 

אופרטור::tensorflow::קלט

 operator::tensorflow::Input() const 

אופרטור::tensorflow::פלט

 operator::tensorflow::Output() const