flandre/test/legacy/testcupy.py

15 lines
264 B
Python
Raw Normal View History

2025-04-13 16:47:14 +08:00
import json
import cupy as cp
import numpy as np
if __name__ == '__main__':
arr = np.array([
[1, 2, 3],
[1, 2, 3],
])
print(type(arr.shape))
print(np.frombuffer(arr.tobytes(), dtype=np.dtype(str(arr.dtype))).reshape(arr.shape))