open3d.core.HashMap¶
-
class
open3d.core.
HashMap
¶ A HashMap is an unordered map from key to value wrapped by Tensors.
-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self, init_capacity, key_dtype, key_element_shape, value_dtype, value_element_shape, device=CPU:0)
- Parameters
init_capacity (int) – Initial capacity of a hash container.
key_dtype (open3d.core.Dtype) – Data type for the input key tensor.
key_element_shape (open3d.core.SizeVector) – Element shape for the input key tensor. E.g. (3) for 3D coordinate keys.
value_dtype (open3d.core.Dtype) – Data type for the input value tensor.
value_element_shape (open3d.core.SizeVector) – Element shape for the input value tensor. E.g. (1) for mapped index.
(open3d.core.Device (device) – 0): Compute device to store and operate on the hash container.
optional – 0): Compute device to store and operate on the hash container.
default=CPU – 0): Compute device to store and operate on the hash container.
__init__(self, init_capacity, key_dtype, key_element_shape, value_dtypes, value_element_shapes, device=CPU:0)
- Parameters
init_capacity (int) – Initial capacity of a hash container.
key_dtype (open3d.core.Dtype) – Data type for the input key tensor.
key_element_shape (open3d.core.SizeVector) – Element shape for the input key tensor. E.g. (3) for 3D coordinate keys.
value_dtypes (List[open3d.core.Dtype]) – List of data type for the input value tensors.
value_element_shapes (List[open3d.core.SizeVector]) – List of element shapes for the input value tensors. E.g. ((8,8,8,1), (8,8,8,3)) for mapped weights and RGB colors stored in 8^3 element arrays.
(open3d.core.Device (device) – 0): Compute device to store and operate on the hash container.
optional – 0): Compute device to store and operate on the hash container.
default=CPU – 0): Compute device to store and operate on the hash container.
-
activate
(self, keys)¶ Activate an array of keys stored in Tensors without copying values.
- Parameters
keys (open3d.core.Tensor) – Input keys stored in a tensor of shape (N, key_element_shape).
- Returns
tuple
-
active_buf_indices
(self: open3d.cpu.pybind.core.HashMap) → open3d.cpu.pybind.core.Tensor¶ Get the buffer indices corresponding to active entries in the hash map.
-
capacity
(self: open3d.cpu.pybind.core.HashMap) → int¶ Get the capacity of the hash map.
-
clone
(self: open3d.cpu.pybind.core.HashMap) → open3d.cpu.pybind.core.HashMap¶ Clone the hash map, including the data structure and the data buffers.
-
cpu
(self: open3d.cpu.pybind.core.HashMap) → open3d.cpu.pybind.core.HashMap¶ Transfer the hash map to CPU. If the hash map is already on CPU, no copy will be performed.
-
cuda
(self, device_id=0)¶ Transfer the hash map to a CUDA device. If the hash map is already on the specified CUDA device, no copy will be performed.
- Parameters
device_id (int, optional, default=0) – Target CUDA device ID.
- Returns
open3d.core.HashMap
-
erase
(self, keys)¶ Erase an array of keys stored in Tensors.
- Parameters
keys (open3d.core.Tensor) – Input keys stored in a tensor of shape (N, key_element_shape).
- Returns
open3d.core.Tensor
-
find
(self, keys)¶ Find an array of keys stored in Tensors.
- Parameters
keys (open3d.core.Tensor) – Input keys stored in a tensor of shape (N, key_element_shape).
- Returns
tuple
-
insert
(*args, **kwargs)¶ Overloaded function.
- insert(self, keys, values)
Insert an array of keys and an array of values stored in Tensors.
- Parameters
keys (open3d.core.Tensor) – Input keys stored in a tensor of shape (N, key_element_shape).
values (open3d.core.Tensor) – Input values stored in a tensor of shape (N, value_element_shape).
- Returns
tuple
- insert(self, keys, list_values)
Insert an array of keys and a list of value arrays stored in Tensors.
- Parameters
keys (open3d.core.Tensor) – Input keys stored in a tensor of shape (N, key_element_shape).
list_values (List[open3d.core.Tensor]) – List of input values stored in tensors of corresponding shapes.
- Returns
tuple
-
key_tensor
(self: open3d.cpu.pybind.core.HashMap) → open3d.cpu.pybind.core.Tensor¶ Get the key tensor stored in the buffer.
-
static
load
(file_name)¶ Load a hash map from a .npz file.
- Parameters
file_name (str) – File name of the corresponding .npz file.
- Returns
open3d.core.HashMap
-
reserve
(self, capacity)¶ Reserve the hash map given the capacity.
- Parameters
capacity (int) – New capacity for rehashing.
- Returns
None
-
save
(self, file_name)¶ Save the hash map into a .npz file.
- Parameters
file_name (str) – File name of the corresponding .npz file.
- Returns
None
-
size
(self: open3d.cpu.pybind.core.HashMap) → int¶ Get the size of the hash map.
-
to
(self, device, copy=False)¶ Convert the hash map to a selected device.
- Parameters
device (open3d.core.Device) – Compute device to store and operate on the hash container.
copy (bool, optional, default=False) – If true, a new tensor is always created; if false, the copy is avoided when the original tensor already has the targeted dtype.
- Returns
open3d.core.HashMap
-
value_tensor
(*args, **kwargs)¶ Overloaded function.
- value_tensor(self)
Get the value tensor stored at index 0.
- Returns
open3d.core.Tensor
- value_tensor(self, value_buffer_id)
Get the value tensor stored at index i
- Parameters
value_buffer_id (int) –
- Returns
open3d.core.Tensor
-
value_tensors
(self: open3d.cpu.pybind.core.HashMap) → List[open3d.cpu.pybind.core.Tensor]¶ Get the list of value tensors stored in the buffer.
-