23 const Dtype& key_dtype,
42 std::pair<Tensor, Tensor>
Insert(
const Tensor& input_keys);
48 std::pair<Tensor, Tensor>
Find(
const Tensor& input_keys);
64 Tensor& output_buf_indices,
71 Tensor& output_buf_indices,
88 void Save(
const std::string& file_name);
100 int64_t
Size()
const;
127 std::shared_ptr<HashMap> internal_;
bool copy
Definition: VtkUtils.cpp:73
Tensor GetKeyTensor() const
Definition: HashSet.cpp:105
void Reserve(int64_t capacity)
Reserve the internal hash map with the capcity by rehashing.
Definition: HashSet.cpp:29
int64_t GetCapacity() const
Get the capacity of the hash set.
Definition: HashSet.cpp:99
Tensor GetActiveIndices() const
Definition: HashSet.cpp:49
HashSet To(const Device &device, bool copy=false) const
Convert the hash set to another device.
Definition: HashSet.cpp:92
int64_t GetBucketCount() const
Get the number of buckets of the internal hash set.
Definition: HashSet.cpp:101
~HashSet()=default
Default destructor.
std::pair< Tensor, Tensor > Insert(const Tensor &input_keys)
Definition: HashSet.cpp:31
void Clear()
Clear stored map without reallocating the buffers.
Definition: HashSet.cpp:76
int64_t Size() const
Get the size (number of active entries) of the hash set.
Definition: HashSet.cpp:97
std::vector< int64_t > BucketSizes() const
Return number of elements per bucket.
Definition: HashSet.cpp:107
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:19
std::pair< Tensor, Tensor > Find(const Tensor &input_keys)
Definition: HashSet.cpp:37
std::shared_ptr< DeviceHashBackend > GetDeviceHashBackend() const
Return the implementation of the device hash backend.
Definition: HashSet.cpp:113
float LoadFactor() const
Return size / bucket_count.
Definition: HashSet.cpp:111
void Save(const std::string &file_name)
Definition: HashSet.cpp:78
Tensor Erase(const Tensor &input_keys)
Definition: HashSet.cpp:43
HashSet Clone() const
Clone the hash set with buffers.
Definition: HashSet.cpp:87
Device GetDevice() const override
Get the device of the hash set.
Definition: HashSet.cpp:103
static HashSet Load(const std::string &file_name)
Load active keys and values from a npz file that contains 'key'.
Definition: HashSet.cpp:82
Definition: SizeVector.h:69
HashBackendType
Definition: HashMap.h:20
Definition: PinholeCameraIntrinsic.cpp:16