Google I/O에 참여해 주셔서 감사합니다. 주문형 모든 세션 보기 주문형 시청

tensorflow :: ops :: OneHot

#include <array_ops.h>

원-핫 텐서를 반환합니다.

요약

인덱스에 의해 표시되는 위치 indices 값 인출 on_value 모든 다른 위치 값을 취하면서, off_value .

입력 indices 가 순위 N 이면 출력은 순위 N+1 이고 새 축은 차원 axis 생성됩니다 (기본값 : 새 축이 끝에 추가됨).

indices 가 스칼라 인 경우 출력 형태는 길이 depth 의 벡터가됩니다.

indices 가 길이 features 벡터 인 경우 출력 형태는 다음과 같습니다.

  features x depth if axis == -1
  depth x features if axis == 0

indices[batch, features] 모양의 행렬 (배치)이면 출력 모양은 다음과 같습니다.

  batch x features x depth if axis == -1
  batch x depth x features if axis == 1
  depth x batch x features if axis == 0

  indices = [0, 2, -1, 1]
  depth = 3
  on_value = 5.0
  off_value = 0.0
  axis = -1

그러면 출력은 [4 x 3] :

output =
  [5.0 0.0 0.0]  // one_hot(0)
  [0.0 0.0 5.0]  // one_hot(2)
  [0.0 0.0 0.0]  // one_hot(-1)
  [0.0 5.0 0.0]  // one_hot(1)
입니다.

  indices = [0, 2, -1, 1]
  depth = 3
  on_value = 0.0
  off_value = 3.0
  axis = 0

그러면 출력은 [3 x 4] :

output =
  [0.0 3.0 3.0 3.0]
  [3.0 3.0 3.0 0.0]
  [3.0 3.0 3.0 3.0]
  [3.0 0.0 3.0 3.0]
//  ^                one_hot(0)
//      ^            one_hot(2)
//          ^        one_hot(-1)
//              ^    one_hot(1)
입니다.

  indices = [[0, 2], [1, -1]]
  depth = 3
  on_value = 1.0
  off_value = 0.0
  axis = -1

그러면 출력은 [2 x 2 x 3] :

output =
  [
    [1.0, 0.0, 0.0]  // one_hot(0)
    [0.0, 0.0, 1.0]  // one_hot(2)
  ][
    [0.0, 1.0, 0.0]  // one_hot(1)
    [0.0, 0.0, 0.0]  // one_hot(-1)
  ]

인수 :

  • 범위 : 범위 개체
  • 인덱스 : 인덱스의 텐서.
  • depth : 하나의 핫 차원의 깊이를 정의하는 스칼라.
  • on_value : indices[j] = i 때 출력을 채울 값을 정의하는 스칼라입니다.
  • off_value : indices[j] != i 때 출력을 채울 값을 정의하는 스칼라입니다.

선택적 속성 ( Attrs 참조) :

  • axis : 채울 축 (기본값 : -1, 새로운 가장 안쪽 축).

보고:

생성자와 소멸자

OneHot (const :: tensorflow::Scope & scope, :: tensorflow::Input indices, :: tensorflow::Input depth, :: tensorflow::Input on_value, :: tensorflow::Input off_value)
OneHot (const :: tensorflow::Scope & scope, :: tensorflow::Input indices, :: tensorflow::Input depth, :: tensorflow::Input on_value, :: tensorflow::Input off_value, const OneHot::Attrs & attrs)

공용 속성

operation
output

공공 기능

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

공개 정적 함수

Axis (int64 x)

구조체

tensorflow :: ops :: OneHot :: 속성

OneHot에 대한 선택적 속성 설정자.

공용 속성

조작

Operation operation

산출

::tensorflow::Output output

공공 기능

OneHot

 OneHot(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input indices,
  ::tensorflow::Input depth,
  ::tensorflow::Input on_value,
  ::tensorflow::Input off_value
)

OneHot

 OneHot(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input indices,
  ::tensorflow::Input depth,
  ::tensorflow::Input on_value,
  ::tensorflow::Input off_value,
  const OneHot::Attrs & attrs
)

마디

::tensorflow::Node * node() const 

연산자 :: tensorflow :: 입력

 operator::tensorflow::Input() const 

연산자 :: tensorflow :: 출력

 operator::tensorflow::Output() const 

공개 정적 함수

중심선

Attrs Axis(
  int64 x
)