텐서플로우:: 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.

논거:

보고:

생성자와 소멸자

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