टेंसरफ़्लो:: ऑप्स:: वनहॉट

#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)
  ]

तर्क:

  • स्कोप: एक स्कोप ऑब्जेक्ट
  • सूचकांक: सूचकांकों का एक टेंसर।
  • गहराई: एक अदिश राशि जो एक गर्म आयाम की गहराई को परिभाषित करती है।
  • on_value: indices[j] = i होने पर आउटपुट में भरने के लिए मान को परिभाषित करने वाला एक स्केलर।
  • off_value: indices[j] != i होने पर आउटपुट में भरने के लिए मान को परिभाषित करने वाला एक स्केलर।

वैकल्पिक विशेषताएँ (देखें Attrs ):

  • अक्ष: भरने के लिए अक्ष (डिफ़ॉल्ट: -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)

संरचनाएँ

टेंसरफ्लो:: ऑप्स:: वनहॉट:: एटर्स

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
)