เทนเซอร์โฟลว์:: ปฏิบัติการ:: เปรียบเทียบและ Bitpack
#include <math_ops.h> เปรียบเทียบค่าของ input กับ threshold และแพ็คบิตผลลัพธ์ลงใน uint8
สรุป
 การเปรียบเทียบแต่ละครั้งจะส่งคืนบูลีน true (หาก input_value > threshold ) หรือมิฉะนั้นจะ false
 การดำเนินการนี้มีประโยชน์สำหรับ Locality-Sensitive-Hashing (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
งานสาธารณะ
เปรียบเทียบและ Bitpack
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