przepływ tensorowy:: ops:: OneHot

#include <array_ops.h>

Zwraca jeden gorący tensor.

Streszczenie

Lokalizacje reprezentowane przez indeksy w indices przyjmują wartość on_value , podczas gdy wszystkie inne lokalizacje przyjmują wartość off_value .

Jeśli indices wejściowe mają rangę N , wyjście będzie miało rangę N+1 . Nowa oś tworzona jest na axis wymiaru (domyślnie: nowa oś jest dodawana na końcu).

Jeśli indices są skalarami, kształtem wyjściowym będzie wektor długości i depth .

Jeśli indices są wektorami features długości, wynikiem będzie następujący kształt:

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

Jeżeli indices jest macierz (partia) o kształcie [batch, features] , to wynikowy kształt będzie następujący:

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

Przykłady

Załóżmy, że

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

Następnie otrzymamy wynik [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)

Załóżmy, że

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

Następnie otrzymamy wynik [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)

Załóżmy, że

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

Następnie otrzymamy wynik [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)
  ]

Argumenty:

  • zakres: Obiekt Scope
  • indeksy: tensor indeksów.
  • głębokość: Skalar określający głębokość jednego gorącego wymiaru.
  • on_value: Skalar definiujący wartość do wypełnienia, gdy indices[j] = i .
  • off_value: Skalar definiujący wartość wypełnianą na wyjściu, gdy indices[j] != i .

Opcjonalne atrybuty (patrz Attrs ):

  • oś: Oś do wypełnienia (domyślnie: -1, nowa oś najbardziej wewnętrzna).

Zwroty:

  • Output : Tensor jednego gorącego.

Konstruktory i destruktory

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)

Atrybuty publiczne

operation
output

Funkcje publiczne

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

Publiczne funkcje statyczne

Axis (int64 x)

Struktury

tensorflow:: ops:: OneHot:: Atrybuty

Opcjonalne moduły ustawiające atrybuty dla OneHot .

Atrybuty publiczne

operacja

Operation operation

wyjście

::tensorflow::Output output

Funkcje publiczne

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
)

węzeł

::tensorflow::Node * node() const 

operator::tensorflow::Wejście

 operator::tensorflow::Input() const 

operator::tensorflow::Wyjście

 operator::tensorflow::Output() const 

Publiczne funkcje statyczne

Attrs Axis(
  int64 x
)