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
ตัวดำเนินการ::เทนเซอร์โฟลว์::อินพุต
operator::tensorflow::Input() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::เอาต์พุต
operator::tensorflow::Output() const