টেনসরফ্লো :: অপস:: বিটকাস্ট

#include <array_ops.h>

ডেটা অনুলিপি না করে একটি টেনসরকে এক প্রকার থেকে অন্য প্রকারে বিটকাস্ট করে।

সারসংক্ষেপ

একটি টেনসর input দেওয়া হলে, এই ক্রিয়াকলাপটি একটি টেনসর প্রদান করে যাতে ডেটাটাইপ type input হিসাবে একই বাফার ডেটা থাকে।

যদি ইনপুট ডেটাটাইপ T আউটপুট ডেটাটাইপ type চেয়ে বড় হয় তবে আকৃতি [...] থেকে [..., sizeof( T )/sizeof( type )] এ পরিবর্তিত হয়।

যদি T type থেকে ছোট হয়, তাহলে অপারেটরের ডানদিকের ডাইমেনশনটি সাইজফ( type )/sizeof( T ) এর সমান হতে হবে। আকৃতি তারপর [..., sizeof( type )/sizeof( T )] থেকে [...] এ যায়।

tf.bitcast() এবং tf.cast() ভিন্নভাবে কাজ করে যখন বাস্তব dtype একটি জটিল dtype হিসাবে কাস্ট করা হয় (যেমন tf.complex64 বা tf.complex128) যেহেতু tf.cast() কাল্পনিক অংশ 0 তৈরি করে যখন tf.bitcast() মডিউল দেয় ত্রুটি. উদাহরণ স্বরূপ,

উদাহরণ 1:

a = [1., 2., 3.] equality_bitcast = tf.bitcast(a, tf.complex128) ট্রেসব্যাক (সর্বশেষ সর্বশেষ কল): ... অবৈধ আর্গুমেন্ট ত্রুটি: 1 থেকে 18 পর্যন্ত বিটকাস্ট করা যাবে না [অপ: বিটকাস্ট ] equality_cast = tf.cast(a, tf.complex128) প্রিন্ট(equality_cast) tf.Tensor([1.+0.j 2.+0.j 3.+0.j], shape=(3,), dtype=complex128)

উদাহরণ 2:

tf.bitcast(tf.constant(0xffffffff, dtype=tf.uint32), tf.uint8)

উদাহরণ 3:

x = [1., 2., 3.] y = [0., 2., 3.] equality= tf.equal(x,y) equality_cast = tf.cast(equality,tf.float32) equality_bitcast = tf. bitcast(equality_cast,tf.uint8) প্রিন্ট(সমতা) tf.Tensor([False True True], shape=(3,), dtype=bool) print(equality_cast) tf.Tensor([0. 1. 1.], shape=(3,), dtype=float32) print(equality_bitcast) tf.Tensor( [[ 0 0 0 0] [ 0 0 128 63] [ 0 0 128 63]], shape=(3, 4), dtype= uint8)

দ্রষ্টব্য : বিটকাস্ট একটি নিম্ন-স্তরের কাস্ট হিসাবে প্রয়োগ করা হয়েছে, তাই বিভিন্ন এন্ডিয়ান অর্ডারিং সহ মেশিনগুলি বিভিন্ন ফলাফল দেবে।

যুক্তি:

রিটার্ন:

  • Output : আউটপুট টেনসর।

কনস্ট্রাক্টর এবং ডেস্ট্রাক্টর

Bitcast (const :: tensorflow::Scope & scope, :: tensorflow::Input input, DataType type)

পাবলিক বৈশিষ্ট্য

operation
output

পাবলিক ফাংশন

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

পাবলিক বৈশিষ্ট্য

অপারেশন

Operation operation

আউটপুট

::tensorflow::Output output

পাবলিক ফাংশন

বিটকাস্ট

 Bitcast(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  DataType type
)

নোড

::tensorflow::Node * node() const 

অপারেটর::টেনসরফ্লো::ইনপুট

 operator::tensorflow::Input() const 

অপারেটর::টেনসরফ্লো::আউটপুট

 operator::tensorflow::Output() const