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

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

মনে করুন যে 0 বি 1 বিবি 35140

তারপরে আউটপুটটি [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[j] = i যখন indices[j] = i । আউটপুট পূরণ করার জন্য মানকে সংজ্ঞায়িত করে এমন একটি স্কেলার।
  • অফ_ভ্যালু: indices[j] != i যখন আউটপুট পূরণ করতে মানকে সংজ্ঞায়িত করে এমন একটি স্কেলার ala

Attrs বৈশিষ্ট্য ( 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)

স্ট্রাক্টস

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

ওয়ানহটের জন্য ptionচ্ছিক অ্যাট্রিবিউট সেটটার

জনসাধারণের গুণাবলী

অপারেশন

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
)