tensorflow::ops::CompareAndBitpack

#include <math_ops.h>

Confronta i valori di input con threshold e impacchetta i bit risultanti in un uint8 .

Riepilogo

Ogni confronto restituisce un valore booleano true (se input_value > threshold ) e false altrimenti.

Questa operazione è utile per l'hashing sensibile alla località (LSH) e altri algoritmi che utilizzano approssimazioni di hashing delle distanze coseno e L2 ; i ​​codici possono essere generati da un input tramite:

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]

NOTA : Attualmente, la dimensione più interna del tensore deve essere divisibile per 8.

Dato un input di forma [s0, s1, ..., s_n] , l'output è un tensore uint8 di forma [s0, s1, ..., s_n / 8] .

Argomentazioni:

  • ambito: un oggetto Scope
  • Input: Valori da confrontare con threshold e il bitpack.
  • soglia: Soglia da confrontare.

Resi:

  • Output : I confronti compressi in bit.

Costruttori e distruttori

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

attributi pubblici

operation
output

Funzioni pubbliche

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

attributi pubblici

operazione

Operation operation

produzione

::tensorflow::Output output

Funzioni pubbliche

CompareAndBitpack

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

nodo

::tensorflow::Node * node() const 

operatore::tensorflow::Input

 operator::tensorflow::Input() const 

operatore::tensoreflusso::output

 operator::tensorflow::Output() const