Convert the input numpy tensor to CUDA device pointer :param np_tensor: input numpy nd array :param is_output: whether the tensor is output :return: CUDA device pointer
(np_tensor: "np.ndarray", is_output: "bool")
| 46 | |
| 47 | @staticmethod |
| 48 | def argument(np_tensor: "np.ndarray", is_output: "bool") -> cuda.CUdeviceptr: |
| 49 | """Convert the input numpy tensor to CUDA device pointer |
| 50 | |
| 51 | :param np_tensor: input numpy nd array |
| 52 | :param is_output: whether the tensor is output |
| 53 | |
| 54 | :return: CUDA device pointer |
| 55 | """ |
| 56 | # copy the data to device |
| 57 | if is_output: |
| 58 | return device_mem_alloc(np_tensor.size * np_tensor.itemsize) |
| 59 | else: |
| 60 | return todevice(np_tensor) |
| 61 | |
| 62 | |
| 63 | class TorchFrontend: |
nothing calls this directly
no test coverage detected