js_reverse/ayf_ocr/02pytorch基础语法/张量和nump数组之间转换.py
2023-05-30 01:25:04 +08:00

8 lines
163 B
Python

import torch
t5 = torch.randint(low=100, high=1000, size=(2, 3, 4))
print(t5.numpy())
t6 = torch.tensor([41, 96, 88, 145], dtype=torch.int32)
print(t6.tolist())