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

#include <math_ops.h>

এর মান তুলনা input করার threshold এবং একটি মধ্যে ফলে বিট প্যাক uint8

সারসংক্ষেপ

প্রতিটি তুলনা একটি বুলিয়ান true (যদি input_value > threshold ) বা অন্যথায় false

লোকেশন-সেনসিটিভ-হ্যাশিং (এলএসএইচ) এবং অন্যান্য অ্যালগরিদমের জন্য এই অপারেশন দরকারী যা কোসাইন এবং L2 দূরত্বের হ্যাশিং অনুমান ব্যবহার করে; কোডগুলি একটি ইনপুট থেকে এর মাধ্যমে উত্পন্ন হতে পারে:

codebook_size = 50
codebook_bits = codebook_size * 32
codebook = tf.get_variable('codebook', [x.shape[-1].value, codebook_bits],
                           dtype=x.dtype,
                           initializer=tf.orthogonal_initializer())
codes = compare_and_threshold(tf.matmul(x, codebook), threshold=0.)
codes = tf.bitcast(codes, tf.int32)  # go from uint8 to int32
# now codes has shape x.shape[:-1] + [codebook_size]

দ্রষ্টব্য : বর্তমানে, টেনসরটির অন্তঃতম মাত্রাটি 8 দ্বারা বিভাজ্য হতে হবে।

[s0, s1, ..., s_n] আকারের একটি input দেওয়া হয়েছে [s0, s1, ..., s_n] একটি uint8 টেনসর আকারের [s0, s1, ..., s_n / 8]

যুক্তি:

  • সুযোগ: একটি স্কোপ অবজেক্ট
  • ইনপুট: threshold এবং বিটপ্যাকের তুলনায় মানগুলি Values
  • থ্রেশহোল্ড: থ্রেশহোল্ডের সাথে তুলনা করতে।

রিটার্নস:

  • Output : বিটপ্যাকড তুলনা।

নির্মাণকারী এবং ধ্বংসকারী

CompareAndBitpack (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input threshold)

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

operation
output

পাবলিক ফাংশন

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

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

অপারেশন

Operation operation

আউটপুট

::tensorflow::Output output

পাবলিক ফাংশন

তুলনাঅ্যান্ডবিটপ্যাক

 CompareAndBitpack(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input threshold
)

নোড

::tensorflow::Node * node() const 

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

 operator::tensorflow::Input() const 

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

 operator::tensorflow::Output() const