tensorflow :: ops :: OneHot
#include <array_ops.h>
Tek sıcak tensör verir.
Özet
İndisler tarafından temsil yerleri indices
değer almak on_value
tüm diğer yerlerde değer alırken, off_value
.
Giriş indices
sıra N
ise, çıktının sıralaması N+1
, 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) 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
indices = [0, 2, -1, 1] depth = 3 on_value = 5.0 off_value = 0.0 axis = -1olduğunu varsayalım
Ardından çıktı [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
Ardından çıktı [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 = -1olduğunu varsayalım
Ardından çıktı [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 Scope nesnesi
- indisler: Bir indis tensörü.
- derinlik: Tek sıcak boyutun derinliğini tanımlayan skaler.
- on_value:
indices[j] = i
olduğunda çıktıya doldurulacak değeri tanımlayan skaler bir skaler. - off_value:
indices[j] != i
olduğunda çıktıda doldurulacak değeri tanımlayan skaler bir skaler.
İsteğe bağlı özellikler (bkz. Attrs
):
- eksen: Doldurulacak eksen (varsayılan: -1, en içteki yeni eksen).
İadeler:
-
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 |
Kamusal işlevler | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Genel statik işlevler | |
---|---|
Axis (int64 x) |
Yapılar | |
---|---|
tensorflow :: ops :: OneHot :: Attrs | OneHot için isteğe bağlı öznitelik belirleyiciler. |
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
operator :: tensorflow :: Girdi
operator::tensorflow::Input() const
operator :: tensorflow :: Çıktı
operator::tensorflow::Output() const
Genel statik işlevler
Eksen
Attrs Axis( int64 x )