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
는 상수 wrt 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
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