tensorflow :: অপস:: ডিকুয়ান্টাইজ করুন

#include <array_ops.h>

একটি ফ্লোট টেনসরে 'ইনপুট' টেনসরকে ডিকুয়ান্টাইজ করুন

সারসংক্ষেপ

[min_range, max_range] হল স্কেলার ফ্লোট যা আউটপুটের জন্য পরিসীমা নির্দিষ্ট করে। 'মোড' অ্যাট্রিবিউট নিয়ন্ত্রণ করে ঠিক কোন গণনাগুলিকে ফ্লোট মানগুলিকে তাদের কোয়ান্টাইজড সমতুল্যগুলিতে রূপান্তর করতে ব্যবহৃত হয়৷

'MIN_COMBINED' মোডে, টেনসরের প্রতিটি মান নিম্নলিখিতগুলির মধ্য দিয়ে যাবে:

if T == qint8: in[i] += (range(T) + 1)/ 2.0
out[i] = min_range + (in[i]* (max_range - min_range) / range(T))
এখানে range(T) = numeric_limits ::max() - numeric_limits ::min() range(T) = numeric_limits ::max() - numeric_limits ::min() range(T) = numeric_limits ::max() - numeric_limits ::min()

MIN_COMBINED মোডের উদাহরণ

যদি ইনপুটটি একটি QuantizedRelu6 থেকে আসে, তাহলে আউটপুটের ধরনটি quint8 (0-255 এর পরিসর) তবে QuantizedRelu6 এর সম্ভাব্য পরিসর হল 0-6। min_range এবং max_range মান তাই 0.0 এবং 6.0। quint8-এ ডিকুয়ান্টাইজ প্রতিটি মান নেবে, ভাসতে কাস্ট করবে এবং 6/255 দ্বারা গুন করবে। মনে রাখবেন যে কোয়ান্টাইজড টাইপ যদি qint8 হয়, তবে কাস্ট করার আগে অপারেশনটি অতিরিক্তভাবে প্রতিটি মান 128 দ্বারা যোগ করবে।

যদি মোডটি 'MIN_FIRST' হয়, তাহলে এই পদ্ধতিটি ব্যবহার করা হয়:

num_discrete_values = 1 << (# of bits in T)
range_adjust = num_discrete_values / (num_discrete_values - 1)
range = (range_max - range_min) * range_adjust
range_scale = range / num_discrete_values
const double offset_input = static_cast(input) - lowest_quantized;
result = range_min + ((input - numeric_limits::min()) * range_scale)

যদি মোডটি SCALED হয়, প্রতিটি ইনপুট মানকে একটি স্কেলিং_ফ্যাক্টর দ্বারা গুণ করে ডিকোয়ান্টাইজেশন করা হয়। (এইভাবে 0 এর একটি ইনপুট সর্বদা 0.0 এ মানচিত্র করে)।

নিম্নোক্ত অ্যালগরিদম ব্যবহার করে QuantizeAndDequantize{V2|V3} এবং QuantizeV2 এর সাথে সামঞ্জস্যপূর্ণ এমনভাবে min_range , max_range , এবং narrow_range থেকে স্কেলিং_ফ্যাক্টর নির্ধারণ করা হয়:

  

  const int min_expected_T = std::numeric_limits::min() +
    (narrow_range ? 1 : 0);
  const int max_expected_T = std::numeric_limits::max();
  const float max_expected_T = std::numeric_limits::max();

  const float scale_factor =
    (std::numeric_limits::min() == 0) ? (max_range / max_expected_T)
                                         : std::max(min_range / min_expected_T,
                                                    max_range / max_expected_T);

যুক্তি:

  • স্কোপ: একটি স্কোপ অবজেক্ট
  • min_range: ন্যূনতম স্কেলার মান সম্ভবত ইনপুট জন্য উত্পাদিত.
  • max_range: সর্বাধিক স্কেলার মান সম্ভবত ইনপুট জন্য উত্পাদিত.

রিটার্ন:

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

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

Dequantize (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input min_range, :: tensorflow::Input max_range)
Dequantize (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input min_range, :: tensorflow::Input max_range, const Dequantize::Attrs & attrs)

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

operation
output

পাবলিক ফাংশন

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

পাবলিক স্ট্যাটিক ফাংশন

Axis (int64 x)
Mode (StringPiece x)
NarrowRange (bool x)

কাঠামো

tensorflow:: ops:: Dequantize:: Attrs

ডিকুয়ান্টাইজের জন্য ঐচ্ছিক অ্যাট্রিবিউট সেটার।

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

অপারেশন

Operation operation

আউটপুট

::tensorflow::Output output

পাবলিক ফাংশন

ডিকুয়ান্টাইজ করুন

 Dequantize(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input min_range,
  ::tensorflow::Input max_range
)

ডিকুয়ান্টাইজ করুন

 Dequantize(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input min_range,
  ::tensorflow::Input max_range,
  const Dequantize::Attrs & attrs
)

নোড

::tensorflow::Node * node() const 

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

 operator::tensorflow::Input() const 

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

 operator::tensorflow::Output() const 

পাবলিক স্ট্যাটিক ফাংশন

অক্ষ

Attrs Axis(
  int64 x
)

মোড

Attrs Mode(
  StringPiece x
)

সংকীর্ণ পরিসর

Attrs NarrowRange(
  bool x
)