38 template <
typename Hash,
typename KeyEq>
61 const Dtype& dtype_key,
62 const Dtype& dtype_value,
74 void Rehash(int64_t buckets);
82 const Tensor& input_values,
121 int64_t
Size()
const;
152 std::shared_ptr<DefaultDeviceHashmap> device_hashmap_;
Hashmap CPU()
Definition: Hashmap.cpp:224
Tensor & GetKeyBuffer()
Definition: Hashmap.cpp:252
int64_t Size() const
Definition: Hashmap.cpp:238
Hashmap CUDA(int device_id=0)
Definition: Hashmap.cpp:231
Hashmap(int64_t init_capacity, const Dtype &dtype_key, const Dtype &dtype_value, const SizeVector &element_shape_key, const SizeVector &element_shape_value, const Device &device)
Definition: Hashmap.cpp:43
Tensor & GetValueBuffer()
Definition: Hashmap.cpp:253
Hashmap Copy(const Device &device)
Definition: Hashmap.cpp:206
void Find(const Tensor &input_keys, Tensor &output_addrs, Tensor &output_masks)
Definition: Hashmap.cpp:148
DeviceHashmap< DefaultHash, DefaultKeyEq > DefaultDeviceHashmap
Definition: DeviceHashmap.h:194
Device GetDevice() const
Definition: Hashmap.cpp:244
void Rehash(int64_t buckets)
Definition: Hashmap.cpp:74
void GetActiveIndices(Tensor &output_indices)
Definition: Hashmap.cpp:198
void Activate(const Tensor &input_keys, Tensor &output_addrs, Tensor &output_masks)
Definition: Hashmap.cpp:120
void Erase(const Tensor &input_keys, Tensor &output_masks)
Definition: Hashmap.cpp:175
Definition: SizeVector.h:102
Tensor GetValueTensor()
Definition: Hashmap.cpp:264
int64_t GetBucketCount() const
Definition: Hashmap.cpp:241
int64_t GetValueBytesize() const
Definition: Hashmap.cpp:248
Tensor GetKeyTensor()
Definition: Hashmap.cpp:255
static const Dtype Undefined
Definition: Dtype.h:41
~Hashmap()
Definition: Hashmap.h:67
void AssertValueDtype(const Dtype &dtype_val, const SizeVector &elem_shape) const
Definition: Hashmap.cpp:296
Dtype GetKeyDtype() const
Definition: Hashmap.h:148
Definition: PinholeCameraIntrinsic.cpp:35
Dtype GetValueDtype() const
Definition: Hashmap.h:149
void Insert(const Tensor &input_keys, const Tensor &input_values, Tensor &output_addrs, Tensor &output_masks)
Definition: Hashmap.cpp:78
float LoadFactor() const
Return size / bucket_count.
Definition: Hashmap.cpp:280
int64_t GetCapacity() const
Definition: Hashmap.cpp:240
static constexpr int64_t kDefaultElemsPerBucket
Definition: Hashmap.h:44
void AssertKeyDtype(const Dtype &dtype_key, const SizeVector &elem_shape) const
Definition: Hashmap.cpp:282
std::vector< int64_t > BucketSizes() const
Definition: Hashmap.cpp:275
int64_t GetKeyBytesize() const
Definition: Hashmap.cpp:245