tensorflow::ops::OneHot
#include <array_ops.h>Tekil kodlamalı bir tensör döndürür.
Özet
indices indekslerle temsil edilen konumlar on_value değerini alırken, diğer tüm konumlar off_value değerini alır.
Giriş indices N dereceden ise, çıktı N+1 dereceden olacaktır. Yeni eksen, boyut axis oluşturulur (varsayılan: yeni eksen sona eklenir).
Eğer indices skalar bir değer ise, çıktı şekli depth uzunluğunda bir vektör olacaktır.
Eğer indices uzunluk features oluşan bir vektör ise, çıktı şekli şu şekilde olacaktır:
features x depth if axis == -1 depth x features if axis == 0
Eğer indices [batch, features] şeklinde bir matris (batch) ise, çıktı şekli şu şekilde olacaktır:
batch x features x depth if axis == -1 batch x depth x features if axis == 1 depth x batch x features if axis == 0
Örnekler
Diyelim ki
indices = [0, 2, -1, 1] depth = 3 on_value = 5.0 off_value = 0.0 axis = -1
O halde çıktı [4 x 3] olur:
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)
Diyelim ki
indices = [0, 2, -1, 1] depth = 3 on_value = 0.0 off_value = 3.0 axis = 0
O halde çıktı [3 x 4] olur:
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)
Diyelim ki
indices = [[0, 2], [1, -1]] depth = 3 on_value = 1.0 off_value = 0.0 axis = -1
O halde çıktı [2 x 2 x 3] olur:
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)
]Argümanlar:
- kapsam: Bir Kapsam nesnesi
- İndeksler: İndekslerden oluşan bir tensör.
- derinlik: Tek boyutlu uzayın derinliğini tanımlayan bir skaler değer.
- on_value:
indices[j] = iolduğunda çıktıya yazılacak değeri tanımlayan bir skalar değer. - off_value:
indices[j] != iolduğunda çıktıya yazılacak değeri tanımlayan bir skalar değer.
İsteğe bağlı özellikler (bkz. Attrs ):
- eksen: Doldurulacak eksen (varsayılan: -1, yeni bir en içteki eksen).
İadeler:
-
Output: Tekil kodlamalı tensör.
Yapıcılar ve Yıkıcılar | |
|---|---|
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) |
Genel özellikler | |
|---|---|
operation | |
output | |
Kamusal işlevler | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
Herkese açık statik fonksiyonlar | |
|---|---|
Axis (int64 x) | |
Yapılar | |
|---|---|
| tensorflow::ops::OneHot::Attrs | OneHot için isteğe bağlı öznitelik ayarlayıcıları. |
Genel özellikler
operasyon
Operation operation
çıktı
::tensorflow::Output output
Kamusal işlevler
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 )
düğüm
::tensorflow::Node * node() const
operatör::tensorflow::Giriş
operator::tensorflow::Input() const
operatör::tensorflow::Çıktı
operator::tensorflow::Output() const
Herkese açık statik fonksiyonlar
Eksen
Attrs Axis( int64 x )