Open3D (C++ API)  0.12.0
Public Member Functions | Static Public Attributes | Protected Member Functions
open3d::core::Hashmap Class Reference

#include <Hashmap.h>

Public Member Functions

 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)
 
 ~Hashmap ()
 
void Rehash (int64_t buckets)
 
void Insert (const Tensor &input_keys, const Tensor &input_values, Tensor &output_addrs, Tensor &output_masks)
 
void Activate (const Tensor &input_keys, Tensor &output_addrs, Tensor &output_masks)
 
void Find (const Tensor &input_keys, Tensor &output_addrs, Tensor &output_masks)
 
void Erase (const Tensor &input_keys, Tensor &output_masks)
 
void GetActiveIndices (Tensor &output_indices)
 
Hashmap Copy (const Device &device)
 
Hashmap CPU ()
 
Hashmap CUDA (int device_id=0)
 
int64_t Size () const
 
int64_t GetCapacity () const
 
int64_t GetBucketCount () const
 
Device GetDevice () const
 
int64_t GetKeyBytesize () const
 
int64_t GetValueBytesize () const
 
TensorGetKeyBuffer ()
 
TensorGetValueBuffer ()
 
Tensor GetKeyTensor ()
 
Tensor GetValueTensor ()
 
std::vector< int64_t > BucketSizes () const
 
float LoadFactor () const
 Return size / bucket_count. More...
 

Static Public Attributes

static constexpr int64_t kDefaultElemsPerBucket = 4
 

Protected Member Functions

void AssertKeyDtype (const Dtype &dtype_key, const SizeVector &elem_shape) const
 
void AssertValueDtype (const Dtype &dtype_val, const SizeVector &elem_shape) const
 
Dtype GetKeyDtype () const
 
Dtype GetValueDtype () const
 

Constructor & Destructor Documentation

◆ Hashmap()

open3d::core::Hashmap::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 
)

Constructor for primitive and custom types, supporting element shapes. Example 1: Key is int<3> coordinate:

Option 1:

Option 2:

  • dtype_key = Dtype(DtypeCode::Object, 3 * Dtype::Int32.ByteSize(), "int3")
  • element_shape_key = {1} Example 2: Key is struct Pt {int x; int y; int z;}
  • dtype_key = Dtype(DtypeCode::Object, sizeof(Pt), "pt")
  • element_shape_key = {1}

◆ ~Hashmap()

open3d::core::Hashmap::~Hashmap ( )
inline

Member Function Documentation

◆ Activate()

void open3d::core::Hashmap::Activate ( const Tensor input_keys,
Tensor output_addrs,
Tensor output_masks 
)

Parallel activate arrays of keys in Tensor. Specifically useful for large value elements (e.g., a tensor), where we can do in-place management after activation. Return : internal indices that can be directly used for advanced indexing in Tensor key/value buffers. : success insertions, must be combined with in advanced indexing.

◆ AssertKeyDtype()

void open3d::core::Hashmap::AssertKeyDtype ( const Dtype dtype_key,
const SizeVector elem_shape 
) const
protected

◆ AssertValueDtype()

void open3d::core::Hashmap::AssertValueDtype ( const Dtype dtype_val,
const SizeVector elem_shape 
) const
protected

◆ BucketSizes()

std::vector< int64_t > open3d::core::Hashmap::BucketSizes ( ) const

Return number of elems per bucket. High performance not required, so directly returns a vector.

◆ Copy()

Hashmap open3d::core::Hashmap::Copy ( const Device device)

◆ CPU()

Hashmap open3d::core::Hashmap::CPU ( )

◆ CUDA()

Hashmap open3d::core::Hashmap::CUDA ( int  device_id = 0)

◆ Erase()

void open3d::core::Hashmap::Erase ( const Tensor input_keys,
Tensor output_masks 
)

Parallel erase an array of keys in Tensor. Output masks is a bool Tensor. Return : success insertions, must be combined with in advanced indexing.

◆ Find()

void open3d::core::Hashmap::Find ( const Tensor input_keys,
Tensor output_addrs,
Tensor output_masks 
)

Parallel find an array of keys in Tensor. Return : internal indices that can be directly used for advanced indexing in Tensor key/value buffers. : success insertions, must be combined with in advanced indexing.

◆ GetActiveIndices()

void open3d::core::Hashmap::GetActiveIndices ( Tensor output_indices)

Parallel collect all iterators in the hash table Return : internal indices that can be directly used for advanced indexing in Tensor key/value buffers.

◆ GetBucketCount()

int64_t open3d::core::Hashmap::GetBucketCount ( ) const

◆ GetCapacity()

int64_t open3d::core::Hashmap::GetCapacity ( ) const

◆ GetDevice()

Device open3d::core::Hashmap::GetDevice ( ) const

◆ GetKeyBuffer()

Tensor & open3d::core::Hashmap::GetKeyBuffer ( )

◆ GetKeyBytesize()

int64_t open3d::core::Hashmap::GetKeyBytesize ( ) const

◆ GetKeyDtype()

Dtype open3d::core::Hashmap::GetKeyDtype ( ) const
inlineprotected

◆ GetKeyTensor()

Tensor open3d::core::Hashmap::GetKeyTensor ( )

◆ GetValueBuffer()

Tensor & open3d::core::Hashmap::GetValueBuffer ( )

◆ GetValueBytesize()

int64_t open3d::core::Hashmap::GetValueBytesize ( ) const

◆ GetValueDtype()

Dtype open3d::core::Hashmap::GetValueDtype ( ) const
inlineprotected

◆ GetValueTensor()

Tensor open3d::core::Hashmap::GetValueTensor ( )

◆ Insert()

void open3d::core::Hashmap::Insert ( const Tensor input_keys,
const Tensor input_values,
Tensor output_addrs,
Tensor output_masks 
)

Parallel insert arrays of keys and values in Tensors. Return : internal indices that can be directly used for advanced indexing in Tensor key/value buffers. : success insertions, must be combined with in advanced indexing.

◆ LoadFactor()

float open3d::core::Hashmap::LoadFactor ( ) const

Return size / bucket_count.

◆ Rehash()

void open3d::core::Hashmap::Rehash ( int64_t  buckets)

Rehash expects extra memory space at runtime, since it consists of 1) dumping all key value pairs to a buffer 2) deallocate old hash table 3) create a new hash table 4) parallel insert dumped key value pairs

◆ Size()

int64_t open3d::core::Hashmap::Size ( ) const

Field Documentation

◆ kDefaultElemsPerBucket

constexpr int64_t open3d::core::Hashmap::kDefaultElemsPerBucket = 4
static

The documentation for this class was generated from the following files: