tensorflow:: ops:: OneHot

#include <array_ops.h>

একটি ওয়ান-হট টেনসর ফেরত দেয়।

সারসংক্ষেপ

indices মধ্যে থাকা 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) হয় যার আকৃতি [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 ):

  • অক্ষ: যে অক্ষটি পূরণ করতে হবে (ডিফল্ট: -১, একটি নতুন অভ্যন্তরীণ অক্ষ)।

ফেরত:

  • 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
)