تينسورفلو :: العمليات :: ديناميك ستيتش
#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]
لـ (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
الوظائف العامة
ديناميك ستيتش
DynamicStitch( const ::tensorflow::Scope & scope, ::tensorflow::InputList indices, ::tensorflow::InputList data )
العقدة
::tensorflow::Node * node() const
المشغل :: tensorflow :: الإدخال
operator::tensorflow::Input() const
المشغل :: Tensorflow :: Output
operator::tensorflow::Output() const
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2022-11-01 (حسب التوقيت العالمي المتفَّق عليه)