(address, shape, dtype, gpu=False)
| 579 | |
| 580 | |
| 581 | def py_buffer_from_address(address, shape, dtype, gpu=False): |
| 582 | import_numpy() |
| 583 | |
| 584 | buff = {"data": (address, False), "shape": tuple(shape), "typestr": np.dtype(dtype).str} |
| 585 | |
| 586 | class py_holder(object): |
| 587 | pass |
| 588 | |
| 589 | holder = py_holder() |
| 590 | holder.__array_interface__ = buff |
| 591 | holder.__cuda_array_interface__ = buff |
| 592 | if not gpu: |
| 593 | return np.array(holder, copy=False) |
| 594 | else: |
| 595 | import_cupy() |
| 596 | return cp.asanyarray(holder) |
| 597 | |
| 598 | |
| 599 | class check_output_pattern: |
no test coverage detected