1 list 與 numpy
numpy2list:
b = list(a) or b = a.tolist()
list2numpy:
n = numpy.array(a)
2 numpy 與 tensor
numpy2tensor:
b= torch.from_numpy(a)
tensor2numpy:
b= a.numpy()
3 list 與 tensor
list2tensor:
b= torch.Tensor(a)
1 list 與 numpy
numpy2list:
b = list(a) or b = a.tolist()
list2numpy:
n = numpy.array(a)
2 numpy 與 tensor
numpy2tensor:
b= torch.from_numpy(a)
tensor2numpy:
b= a.numpy()
3 list 與 tensor
list2tensor:
b= torch.Tensor(a)
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。