Tnesor 常用的数据类型和函数
数据类型:
TORCH.TENSOR
A torch.Tensor
is a multi-dimensional matrix containing elements of a single data type.
Torch defines 10 tensor types with CPU and GPU variants which are as follows:
Data type | dtype | CPU tensor | GPU tensor |
---|---|---|---|
32-bit floating point |
|
|
|
64-bit floating point |
|
|
|
16-bit floating point 1 |
|
|
|
16-bit floating point 2 |
|
|
|
32-bit complex |
| ||
64-bit complex |
| ||
128-bit complex |
| ||
8-bit integer (unsigned) |
|
|
|
8-bit integer (signed) |
|
|
|
16-bit integer (signed) |
|
|
|
32-bit integer (signed) |
|
|
|
64-bit integer (signed) |
|
|
|
Boolean |
|
|
|
Tensor.
item
() → number
Returns the value of this tensor as a standard Python number
pytorch 下安装Tensorflow的解决方法
pip --default-timeout=100 install tensorflow -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com