We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@ti.func def find(self, k: ti.template(), create: bool = False) -> ti.int32: h = self._hash(k) % self.capacity_ return_value = 0 while True: e = ti.atomic_add(self.table_[h], 0) if (e == -1): if (create): tmp = ti.atomic_add(self.filled_[None], 1) for i in range(self.feature_dim_): ti.atomic_add(self.features_[tmp * self.feature_dim_ + i], k[i]) self.table_[h] = tmp return_value = tmp # print("created") break else: # ti.atomic_add(return_value, e) return_value = ti.atomic_add(e, 0) # print("not exist") break good = True for i in range(self.feature_dim_): if good and self.features_[e * self.feature_dim_ + i] != k[i]: good = False if good: return_value = ti.atomic_add(e, 0) # print("found") break h += 1 if (h == self.capacity_): h = 0 # print(f"===============return{self.filled_[None]}=============") # print(return_value) return return_value
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: