tensorflow:: ops:: CompareAndBitpack

#include <math_ops.h>

قارن قيم input threshold وقم بتجميع البتات الناتجة في uint8 .

ملخص

تُرجع كل مقارنة قيمة منطقية true (إذا كانت input_value > threshold ) أو false في غير ذلك.

تُعد هذه العملية مفيدة لخوارزمية التجزئة الحساسة للموقع (LSH) وغيرها من الخوارزميات التي تستخدم تقريبات التجزئة لمسافات جيب التمام ومسافات 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.

بالنظر إلى input على شكل [s0, s1, ..., s_n] ، يكون الناتج عبارة عن موتر uint8 على شكل [s0, s1, ..., s_n / 8] .

الحجج:

  • النطاق: كائن النطاق
  • المدخلات: القيم المراد مقارنتها threshold وحزمة البتات.
  • العتبة: العتبة التي تتم المقارنة بها.

المرتجعات:

  • 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

 operator::tensorflow::Input() const 

operator::tensorflow::Output

 operator::tensorflow::Output() const