MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / __init__

Method __init__

samples/python/common.py:141–148  ·  view source on GitHub ↗
(self, size: int, dtype: np.dtype)

Source from the content-addressed store, hash-verified

139class HostDeviceMem:
140 """Pair of host and device memory, where the host memory is wrapped in a numpy array"""
141 def __init__(self, size: int, dtype: np.dtype):
142 nbytes = size * dtype.itemsize
143 host_mem = cuda_call(cudart.cudaMallocHost(nbytes))
144 pointer_type = ctypes.POINTER(np.ctypeslib.as_ctypes_type(dtype))
145
146 self._host = np.ctypeslib.as_array(ctypes.cast(host_mem, pointer_type), (size,))
147 self._device = cuda_call(cudart.cudaMalloc(nbytes))
148 self._nbytes = nbytes
149
150 @property
151 def host(self) -> np.ndarray:

Callers

nothing calls this directly

Calls 2

cuda_callFunction · 0.85
castMethod · 0.45

Tested by

no test coverage detected