AsyncGpuResult#

class nvmolkit.types.AsyncGpuResult(obj, gpu_id: int | None = None)#

Handle to a GPU result.

Populates the __cuda_array_interface__ attribute which can be consumed by other libraries. Note that this result is async, and the data cannot be accessed without a sync, such as torch.cuda.synchronize().

__init__(obj, gpu_id: int | None = None)#

Internal construction of the AsyncGpuResult object.

Parameters:
  • obj – An object exposing __cuda_array_interface__.

  • gpu_id – Optional GPU device id where the underlying buffer lives. If omitted, torch infers the device from the CUDA pointer attributes (typically the current device).

property device#

Return the device of the underlying data.

torch()#

Return the underlying data as a torch tensor. This is an asynchronous operation.

numpy()#

Return the underlying data as a numpy array. This is a blocking operation.