تينسورفلو :: العمليات :: قارنAndBitpack
#include <math_ops.h>
قارن قيم input
threshold
uint8
البتات الناتجة في 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
و bitpack. - العتبة: عتبة المقارنة بها.
عائدات:
-
Output
: مقارنات bitpacked.
البنائين والمدمرين | |
---|---|
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
الوظائف العامة
قارنAndBitpack
CompareAndBitpack( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input threshold )
العقدة
::tensorflow::Node * node() const
المشغل :: tensorflow :: الإدخال
operator::tensorflow::Input() const
المشغل :: Tensorflow :: Output
operator::tensorflow::Output() const
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-04-20 UTC.