텐서플로우:: ops:: CompareAndBitpack
#include <math_ops.h> input 값을 threshold 과 비교하고 결과 비트를 uint8 에 저장합니다.
요약
각 비교는 input_value > threshold 보다 true , 그렇지 않으면 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] 인 경우 출력은 [s0, s1, ..., s_n / 8] 형태의 uint8 텐서입니다.
논거:
- 범위: Scope 객체
- 입력:
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
CompareAndBitpack( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input threshold )
마디
::tensorflow::Node * node() const
연산자::텐서플로우::입력
operator::tensorflow::Input() const
연산자::텐서플로우::출력
operator::tensorflow::Output() const