| 141 | } |
| 142 | |
| 143 | void 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 | |
| 158 | void DenseLshProjection(const TfLiteTensor* hash, const TfLiteTensor* input, |
| 159 | const TfLiteTensor* weight, int32_t* out_buf) { |
no test coverage detected