Open3D (C++ API)
0.18.0+252c867
|
#include <HashSet.h>
Public Member Functions | |
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. More... | |
~HashSet ()=default | |
Default destructor. More... | |
void | Reserve (int64_t capacity) |
Reserve the internal hash map with the capcity by rehashing. More... | |
std::pair< Tensor, Tensor > | Insert (const Tensor &input_keys) |
std::pair< Tensor, Tensor > | Find (const Tensor &input_keys) |
Tensor | Erase (const Tensor &input_keys) |
Tensor | GetActiveIndices () const |
void | Insert (const Tensor &input_keys, Tensor &output_buf_indices, Tensor &output_masks) |
void | Find (const Tensor &input_keys, Tensor &output_buf_indices, Tensor &output_masks) |
void | Erase (const Tensor &input_keys, Tensor &output_masks) |
void | GetActiveIndices (Tensor &output_buf_indices) const |
void | Clear () |
Clear stored map without reallocating the buffers. More... | |
void | Save (const std::string &file_name) |
HashSet | Clone () const |
Clone the hash set with buffers. More... | |
HashSet | To (const Device &device, bool copy=false) const |
Convert the hash set to another device. More... | |
int64_t | Size () const |
Get the size (number of active entries) of the hash set. More... | |
int64_t | GetCapacity () const |
Get the capacity of the hash set. More... | |
int64_t | GetBucketCount () const |
Get the number of buckets of the internal hash set. More... | |
Device | GetDevice () const override |
Get the device of the hash set. More... | |
Tensor | GetKeyTensor () const |
std::vector< int64_t > | BucketSizes () const |
Return number of elements per bucket. More... | |
float | LoadFactor () const |
Return size / bucket_count. More... | |
std::shared_ptr< DeviceHashBackend > | GetDeviceHashBackend () const |
Return the implementation of the device hash backend. More... | |
Public Member Functions inherited from open3d::core::IsDevice | |
IsDevice ()=default | |
virtual | ~IsDevice ()=default |
bool | IsCPU () const |
bool | IsCUDA () const |
Static Public Member Functions | |
static HashSet | Load (const std::string &file_name) |
Load active keys and values from a npz file that contains 'key'. More... | |
open3d::core::HashSet::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.
|
default |
Default destructor.
std::vector< int64_t > open3d::core::HashSet::BucketSizes | ( | ) | const |
Return number of elements per bucket.
void open3d::core::HashSet::Clear | ( | ) |
Clear stored map without reallocating the buffers.
HashSet open3d::core::HashSet::Clone | ( | ) | const |
Clone the hash set with buffers.
Parallel erase an array of keys in Tensor. Return: output_masks stores if the erase is a success or failure (key not found all already erased in another thread).
Same as Erase, but takes output_masks as input. If its shape and type matches, reallocation is not needed.
Parallel find an array of keys in Tensor. Return: output_buf_indices, its role is the same as in Insert. Return: output_masks stores if the finding is a success or failure (key not found).
void open3d::core::HashSet::Find | ( | const Tensor & | input_keys, |
Tensor & | output_buf_indices, | ||
Tensor & | output_masks | ||
) |
Same as Find, but takes output_buf_indices and output_masks as input. If their shapes and types match, reallocation is not needed.
Tensor open3d::core::HashSet::GetActiveIndices | ( | ) | const |
Parallel collect all indices in the buffer corresponding to the active entries in the hash map. Return output_buf_indices, collected buffer indices.
void open3d::core::HashSet::GetActiveIndices | ( | Tensor & | output_buf_indices | ) | const |
Same as GetActiveIndices, but takes output_buf_indices as input. If its shape and type matches, reallocation is not needed.
int64_t open3d::core::HashSet::GetBucketCount | ( | ) | const |
Get the number of buckets of the internal hash set.
int64_t open3d::core::HashSet::GetCapacity | ( | ) | const |
Get the capacity of the hash set.
|
overridevirtual |
Get the device of the hash set.
Implements open3d::core::IsDevice.
std::shared_ptr< DeviceHashBackend > open3d::core::HashSet::GetDeviceHashBackend | ( | ) | const |
Return the implementation of the device hash backend.
Tensor open3d::core::HashSet::GetKeyTensor | ( | ) | const |
Get the key tensor buffer to be used along with buf_indices and masks. Example: GetKeyTensor().IndexGet({buf_indices.To(core::Int64).IndexGet{masks}})
Parallel insert arrays of keys and values in Tensors. Return: output_buf_indices stores buffer indices that access buffer tensors obtained from GetKeyTensor() and GetValueTensor() via advanced indexing. NOTE: output_buf_indices are stored in Int32. A conversion to Int64 is required for further indexing. Return: output_masks stores if the insertion is a success or failure (key already exists).
void open3d::core::HashSet::Insert | ( | const Tensor & | input_keys, |
Tensor & | output_buf_indices, | ||
Tensor & | output_masks | ||
) |
Same as Insert, but takes output_buf_indices and output_masks as input. If their shapes and types match, reallocation is not needed.
|
static |
Load active keys and values from a npz file that contains 'key'.
float open3d::core::HashSet::LoadFactor | ( | ) | const |
Return size / bucket_count.
void open3d::core::HashSet::Reserve | ( | int64_t | capacity | ) |
Reserve the internal hash map with the capcity by rehashing.
void open3d::core::HashSet::Save | ( | const std::string & | file_name | ) |
Save active keys to a npz file at 'key'. The file name should end with 'npz', otherwise 'npz' will be added as an extension.
int64_t open3d::core::HashSet::Size | ( | ) | const |
Get the size (number of active entries) of the hash set.
Convert the hash set to another device.