Where

공개 최종 수업 어디서

텐서에서 0이 아닌 값/참 값의 위치를 ​​반환합니다.

이 연산은 '조건'에 있는 참 요소의 좌표를 반환합니다. 좌표는 2차원 텐서로 반환됩니다. 여기서 첫 번째 차원(행)은 실제 요소의 수를 나타내고 두 번째 차원(열)은 실제 요소의 좌표를 나타냅니다. 출력 텐서의 모양은 `조건`에 참값이 얼마나 많이 있는지에 따라 달라질 수 있다는 점에 유의하세요. 인덱스는 행 우선 순서로 출력됩니다.

예:

# 'input' tensor is [[True, False]
 #                    [True, False]]
 # 'input' has two true values, so output has two coordinates.
 # 'input' has rank of 2, so coordinates have two indices.
 where(input) ==> [[0, 0],
                   [1, 0]]
 
 # `condition` tensor is [[[True, False]
 #                     [True, False]]
 #                    [[False, True]
 #                     [False, True]]
 #                    [[False, False]
 #                     [False, True]]]
 # 'input' has 5 true values, so output has 5 coordinates.
 # 'input' has rank of 3, so coordinates have three indices.
 where(input) ==> [[0, 0, 0],
                   [0, 1, 0],
                   [1, 0, 1],
                   [1, 1, 1],
                   [2, 1, 1]]
 
 # `condition` tensor is [[[1.5,  0.0]
 #                     [-0.5, 0.0]]
 #                    [[0.0,  0.25]
 #                     [0.0,  0.75]]
 #                    [[0.0,  0.0]
 #                     [0.0,  0.01]]]
 # 'input' has 5 nonzero values, so output has 5 coordinates.
 # 'input' has rank of 3, so coordinates have three indices.
 where(input) ==> [[0, 0, 0],
                   [0, 1, 0],
                   [1, 0, 1],
                   [1, 1, 1],
                   [2, 1, 1]]
 
 # `condition` tensor is [[[1.5 + 0.0j, 0.0  + 0.0j]
 #                     [0.0 + 0.5j, 0.0  + 0.0j]]
 #                    [[0.0 + 0.0j, 0.25 + 1.5j]
 #                     [0.0 + 0.0j, 0.75 + 0.0j]]
 #                    [[0.0 + 0.0j, 0.0  + 0.0j]
 #                     [0.0 + 0.0j, 0.01 + 0.0j]]]
 # 'input' has 5 nonzero magnitude values, so output has 5 coordinates.
 # 'input' has rank of 3, so coordinates have three indices.
 where(input) ==> [[0, 0, 0],
                   [0, 1, 0],
                   [1, 0, 1],
                   [1, 1, 1],
                   [2, 1, 1]]
 

공개 방법

출력 <긴>
출력 ()
텐서의 기호 핸들을 반환합니다.
정적 <T> 여기서
생성 ( 범위 범위, 피연산자 <T> 조건)
새로운 Where 작업을 래핑하는 클래스를 생성하는 팩토리 메서드입니다.
출력 <긴>
색인 ()

상속된 메서드

공개 방법

공개 출력 <Long> asOutput ()

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

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

공개 정적 어디서 생성 ( 범위 범위, 피연산자 <T> 조건)

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

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

공개 출력 <Long> 인덱스 ()