tensor akışı:: işlem:: OneHot
#include <array_ops.h>Tek sıcak tensör döndürür.
Özet
indices indekslerle temsil edilen konumlar on_value değer alırken, diğer tüm konumlar off_value değer alır.
Giriş indices N sıralaması ise, çıktı N+1 sıralamasına sahip olacaktır. Yeni eksen, boyut axis oluşturulur (varsayılan: yeni eksen sona eklenir).
indices skaler ise çıktı şekli uzunluk depth bir vektörü olacaktır.
indices uzunluk features bir vektörüyse çıktı şekli şöyle olacaktır:
features x depth if axis == -1 depth x features if axis == 0
indices [batch, features] şeklinde bir matris (toplu iş) ise, çıktı şekli şöyle 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
varsayalım ki
indices = [0, 2, -1, 1] depth = 3 on_value = 5.0 off_value = 0.0 axis = -1
O zaman çı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)
varsayalım ki
indices = [0, 2, -1, 1] depth = 3 on_value = 0.0 off_value = 3.0 axis = 0
O zaman çı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)
varsayalım ki
indices = [[0, 2], [1, -1]] depth = 3 on_value = 1.0 off_value = 0.0 axis = -1
O zaman çıktı şu şekildedir: [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)
]Argümanlar:
- kapsam: Bir Kapsam nesnesi
- endeksler: Endekslerin tensörü.
- derinlik: Bir sıcak boyutun derinliğini tanımlayan bir skaler.
- on_value:
indices[j] = iolduğunda çıktıda doldurulacak değeri tanımlayan bir skaler. - off_value:
indices[j] != iolduğunda çıktıda doldurulacak değeri tanımlayan bir skaler.
İsteğe bağlı özellikler (bkz. Attrs ):
- eksen: Doldurulacak eksen (varsayılan: -1, yeni bir en iç eksen).
İade:
-
Output: Tek sıcak 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 | |
Kamu işlevleri | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
Genel statik işlevler | |
|---|---|
Axis (int64 x) | |
Yapılar | |
|---|---|
| tensorflow:: ops:: OneHot:: Öznitelikler | OneHot için isteğe bağlı özellik ayarlayıcılar. |
Genel özellikler
operasyon
Operation operation
çıktı
::tensorflow::Output output
Kamu işlevleri
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
Genel statik işlevler
Eksen
Attrs Axis( int64 x )