텐서플로우:: 작전:: 원핫
#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)
]인수:
- 범위: 범위 개체
- indices: 인덱스의 텐서.
- 깊이: 하나의 핫 차원의 깊이를 정의하는 스칼라입니다.
- on_value:
indices[j] = i일 때 출력에 채울 값을 정의하는 스칼라입니다. - off_value:
indices[j] != i일 때 출력에 채울 값을 정의하는 스칼라입니다.
선택적 속성( Attrs 참조):
- axis: 채울 축(기본값: -1, 가장 안쪽의 새로운 축)
보고:
-
Output: 원-핫 텐서.
생성자와 소멸자 | |
|---|---|
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) | |
구조체 | |
|---|---|
| 텐서플로우:: ops:: OneHot:: 속성 | OneHot 의 선택적 속성 설정자입니다. |
공개 속성
작업
Operation operation
산출
::tensorflow::Output output
공공 기능
원핫
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 )
마디
::tensorflow::Node * node() const
연산자::텐서플로우::입력
operator::tensorflow::Input() const
연산자::텐서플로우::출력
operator::tensorflow::Output() const
공개 정적 함수
중심선
Attrs Axis( int64 x )