tensorflow:: عملیات:: دوخت موازی پویا

#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