41 const Dtype& key_dtype,
60 std::pair<Tensor, Tensor>
Insert(
const Tensor& input_keys);
66 std::pair<Tensor, Tensor>
Find(
const Tensor& input_keys);
82 Tensor& output_buf_indices,
89 Tensor& output_buf_indices,
106 void Save(
const std::string& file_name);
118 int64_t
Size()
const;
145 std::shared_ptr<HashMap> internal_;
int64_t GetCapacity() const
Get the capacity of the hash set.
Definition: HashSet.cpp:118
HashSet To(const Device &device, bool copy=false) const
Convert the hash set to another device.
Definition: HashSet.cpp:111
std::vector< int64_t > BucketSizes() const
Return number of elements per bucket.
Definition: HashSet.cpp:126
void Save(const std::string &file_name)
Definition: HashSet.cpp:97
HashBackendType
Definition: HashMap.h:38
void Reserve(int64_t capacity)
Reserve the internal hash map with the capcity by rehashing.
Definition: HashSet.cpp:48
Tensor Erase(const Tensor &input_keys)
Definition: HashSet.cpp:62
std::pair< Tensor, Tensor > Find(const Tensor &input_keys)
Definition: HashSet.cpp:56
Definition: SizeVector.h:79
std::pair< Tensor, Tensor > Insert(const Tensor &input_keys)
Definition: HashSet.cpp:50
int64_t GetBucketCount() const
Get the number of buckets of the internal hash set.
Definition: HashSet.cpp:120
int64_t Size() const
Get the size (number of active entries) of the hash set.
Definition: HashSet.cpp:116
float LoadFactor() const
Return size / bucket_count.
Definition: HashSet.cpp:130
Tensor GetActiveIndices() const
Definition: HashSet.cpp:68
~HashSet()=default
Default destructor.
HashSet(int64_t init_capacity, const Dtype &key_dtype, const SizeVector &key_element_shape, const Device &device, const HashBackendType &backend=HashBackendType::Default)
Initialize a hash set given a key dtype and element shape.
Definition: HashSet.cpp:38
static HashSet Load(const std::string &file_name)
Load active keys and values from a npz file that contains 'key'.
Definition: HashSet.cpp:101
Definition: PinholeCameraIntrinsic.cpp:35
Tensor GetKeyTensor() const
Definition: HashSet.cpp:124
Device GetDevice() const
Get the device of the hash set.
Definition: HashSet.cpp:122
void Clear()
Clear stored map without reallocating the buffers.
Definition: HashSet.cpp:95
HashSet Clone() const
Clone the hash set with buffers.
Definition: HashSet.cpp:106
std::shared_ptr< DeviceHashBackend > GetDeviceHashBackend() const
Return the implementation of the device hash backend.
Definition: HashSet.cpp:132