cloudViewer.core.HashSet#

class cloudViewer.core.HashSet#

A HashSet is an unordered set of keys wrapped by Tensors.

__init__(self, init_capacity, key_dtype, key_element_shape, device=Device('CPU', 0))#
Parameters:
active_buf_indices(self: cloudViewer.core.HashSet) cloudViewer.core.Tensor#

Get the buffer indices corresponding to active entries in the hash set.

capacity(self: cloudViewer.core.HashSet) int#

Get the capacity of the hash set.

clone(self: cloudViewer.core.HashSet) cloudViewer.core.HashSet#

Clone the hash set, including the data structure and the data buffers.

cpu(self: cloudViewer.core.HashSet) cloudViewer.core.HashSet#

Transfer the hash set to CPU. If the hash set is already on CPU, no copy will be performed.

cuda(self, device_id=0)#

Transfer the hash set to a CUDA device. If the hash set is already on the specified CUDA device, no copy will be performed.

Parameters:

device_id (SupportsInt, optional, default=0) – Target CUDA device ID.

Returns:

cloudViewer.core.HashSet

erase(self, keys)#

Erase an array of keys stored in Tensors.

Parameters:

keys (cloudViewer.core.Tensor) – Input keys stored in a tensor of shape (N, key_element_shape).

Returns:

cloudViewer.core.Tensor

find(self, keys)#

Find an array of keys stored in Tensors.

Parameters:

keys (cloudViewer.core.Tensor) – Input keys stored in a tensor of shape (N, key_element_shape).

Returns:

tuple

insert(self, keys)#

Insert an array of keys stored in Tensors.

Parameters:

keys (cloudViewer.core.Tensor) – Input keys stored in a tensor of shape (N, key_element_shape).

Returns:

tuple

key_tensor(self: cloudViewer.core.HashSet) cloudViewer.core.Tensor#

Get the key tensor stored in the buffer.

static load(file_name)#

Load a hash set from a .npz file.

Parameters:

file_name (str) – File name of the corresponding .npz file.

Returns:

cloudViewer.core.HashSet

reserve(self, capacity)#

Reserve the hash set given the capacity.

Parameters:

capacity (SupportsInt) – New capacity for rehashing.

Returns:

None

save(self, file_name)#

Save the hash set into a .npz file.

Parameters:

file_name (str) – File name of the corresponding .npz file.

Returns:

None

size(self: cloudViewer.core.HashSet) int#

Get the size of the hash set.

to(self, device, copy=False)#

Convert the hash set to a selected device.

Parameters:
  • device (cloudViewer.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:

cloudViewer.core.HashSet

property device#
property is_cpu#
property is_cuda#