1. 关于torch张量tensor
from __future__
import print_function
import torch
matrix
= torch
.randn
(2,3)
print(type(matrix
))
print(matrix
.size
())
matrix1
= torch
.rand
(2,3)
print(type(matrix1
))
print(matrix1
.size
())
matrix2
= torch
.FloatTensor
([2,3])
print(matrix2
)
print(type(matrix2
))
print(matrix2
.size
())
输出:
<class 'torch.Tensor'>
torch
.Size
([2, 3])
<class 'torch.Tensor'>
torch
.Size
([2, 3])
tensor
([2., 3.])
<class 'torch.Tensor'>
torch
.Size
([2])
转载请注明原文地址: https://yun.8miu.com/read-138660.html