MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SparseLshProjection

Function SparseLshProjection

tensorflow/lite/kernels/lsh_projection.cc:143–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143void SparseLshProjection(const TfLiteTensor* hash, const TfLiteTensor* input,
144 const TfLiteTensor* weight, int32_t* out_buf) {
145 int num_hash = SizeOfDimension(hash, 0);
146 int num_bits = SizeOfDimension(hash, 1);
147 for (int i = 0; i < num_hash; i++) {
148 int32_t hash_signature = 0;
149 for (int j = 0; j < num_bits; j++) {
150 float seed = hash->data.f[i * num_bits + j];
151 int bit = RunningSignBit(input, weight, seed);
152 hash_signature = (hash_signature << 1) | bit;
153 }
154 *out_buf++ = hash_signature + i * (1 << num_bits);
155 }
156}
157
158void DenseLshProjection(const TfLiteTensor* hash, const TfLiteTensor* input,
159 const TfLiteTensor* weight, int32_t* out_buf) {

Callers 1

EvalFunction · 0.85

Calls 2

SizeOfDimensionFunction · 0.85
RunningSignBitFunction · 0.85

Tested by

no test coverage detected