টেনসরফ্লো :: অপস:: ওয়ানহট

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

যুক্তি:

  • স্কোপ: একটি স্কোপ অবজেক্ট
  • indices: সূচকের একটি টেনসর।
  • গভীরতা: একটি স্কেলার একটি গরম মাত্রার গভীরতা নির্ধারণ করে।
  • 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)

কাঠামো

tensorflow:: ops:: OneHot:: Attrs

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
)