Google I/O에 참여해 주셔서 감사합니다. 주문형 모든 세션 보기 주문형 시청

tensorflow :: ops :: CompareAndBitpack

#include <math_ops.h>

input 값을 threshold 과 비교하고 결과 비트를 uint8 합니다.

요약

각 비교는 부울 true ( input_value > threshold 경우)를 반환하고 그렇지 않으면 false 반환합니다.

이 연산은 코사인 및 L2 거리의 해싱 근사를 사용하는 LSH (Locality-Sensitive-Hashing) 및 기타 알고리즘에 유용합니다. 다음을 통해 입력에서 코드를 생성 할 수 있습니다.

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로 나눌 수 있어야합니다.

[s0, s1, ..., s_n] 형태의 input 주어지면 출력은 [s0, s1, ..., s_n / 8] 형태의 uint8 텐서입니다.

인수 :

  • 범위 : 범위 개체
  • 입력 : threshold 및 비트 팩과 비교할 값.
  • 임계 값 : 비교할 임계 값입니다.

보고:

생성자와 소멸자

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

 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