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 

אופרטור::tensorflow::קלט

 operator::tensorflow::Input() const 

אופרטור::tensorflow::פלט

 operator::tensorflow::Output() const