টেনসরফ্লো :: অপস:: প্যারালাল ডাইনামিক স্টিচ

#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] এ প্রদর্শিত হয়, ফলাফলটি অবৈধ হতে পারে। এটি সাধারণ ডায়নামিক স্টিচ অপারেটর থেকে পৃথক যা সেই ক্ষেত্রে আচরণকে সংজ্ঞায়িত করে।

উদাহরণ স্বরূপ:

    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