DynamicStitch

공개 최종 클래스 DynamicStitch

'데이터' 텐서의 값을 단일 텐서에 인터리브합니다.

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 + 상수`가 있어야 합니다. 이 `상수` 측면에서 출력 형태는 다음과 같습니다.

merged.shape = [최대(인덱스) + 1] + 상수

값은 순서대로 병합되므로 `(m,i) < (n,j)`에 대해 `indices[m][i]`와 `indices[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]]
 
이 방법은 다음
# 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.
 
에 표시된 대로 `dynamic_partition`으로 생성된 파티션을 병합하는 데 사용할 수 있습니다.

공개 방법

출력 <T>
출력 ()
텐서의 기호 핸들을 반환합니다.
정적 <T> DynamicStitch <T>
생성 ( Scope 범위, Iterable< Operand <Integer>> 인덱스, Iterable< Operand <T>> 데이터)
새로운 DynamicStitch 작업을 래핑하는 클래스를 생성하는 팩토리 메서드입니다.
출력 <T>

상속된 메서드

공개 방법

공개 출력 <T> asOutput ()

텐서의 기호 핸들을 반환합니다.

TensorFlow 작업에 대한 입력은 다른 TensorFlow 작업의 출력입니다. 이 메서드는 입력 계산을 나타내는 기호 핸들을 얻는 데 사용됩니다.

공개 정적 DynamicStitch <T> 생성 ( 범위 범위, Iterable< Operand <Integer>> 인덱스, Iterable< Operand <T>> 데이터)

새로운 DynamicStitch 작업을 래핑하는 클래스를 생성하는 팩토리 메서드입니다.

매개변수
범위 현재 범위
보고
  • DynamicStitch의 새로운 인스턴스

공개 출력 <T> 병합 ()