@@ -8,21 +8,33 @@ torch.Tensor
88A :class: `torch.Tensor ` is a multi-dimensional matrix containing elements of
99a single data type.
1010
11- Torch defines nine CPU tensor types and nine GPU tensor types :
11+ Torch defines 10 tensor types with CPU and GPU variants :
1212
13- ======================== =========================================== =========================== ================================
13+ ========================== =========================================== ============================= ================================
1414Data type dtype CPU tensor GPU tensor
15- ======================== =========================================== =========================== ================================
15+ ========================== =========================================== ============================= ================================
161632-bit floating point ``torch.float32 `` or ``torch.float `` :class: `torch.FloatTensor ` :class: `torch.cuda.FloatTensor `
171764-bit floating point ``torch.float64 `` or ``torch.double `` :class: `torch.DoubleTensor ` :class: `torch.cuda.DoubleTensor `
18- 16-bit floating point ``torch.float16 `` or ``torch.half `` :class: `torch.HalfTensor ` :class: `torch.cuda.HalfTensor `
18+ 16-bit floating point [1 ]_ ``torch.float16 `` or ``torch.half `` :class: `torch.HalfTensor ` :class: `torch.cuda.HalfTensor `
19+ 16-bit floating point [2 ]_ ``torch.bfloat16 `` :class: `torch.BFloat16Tensor ` :class: `torch.cuda.BFloat16Tensor `
20+ 32-bit complex ``torch.complex32 ``
21+ 64-bit complex ``torch.complex64 ``
22+ 128-bit complex ``torch.complex128 `` or ``torch.cdouble ``
19238-bit integer (unsigned) ``torch.uint8 `` :class: `torch.ByteTensor ` :class: `torch.cuda.ByteTensor `
20248-bit integer (signed) ``torch.int8 `` :class: `torch.CharTensor ` :class: `torch.cuda.CharTensor `
212516-bit integer (signed) ``torch.int16 `` or ``torch.short `` :class: `torch.ShortTensor ` :class: `torch.cuda.ShortTensor `
222632-bit integer (signed) ``torch.int32 `` or ``torch.int `` :class: `torch.IntTensor ` :class: `torch.cuda.IntTensor `
232764-bit integer (signed) ``torch.int64 `` or ``torch.long `` :class: `torch.LongTensor ` :class: `torch.cuda.LongTensor `
2428Boolean ``torch.bool `` :class: `torch.BoolTensor ` :class: `torch.cuda.BoolTensor `
25- ======================== =========================================== =========================== ================================
29+ ========================== =========================================== ============================= ================================
30+
31+ .. [1 ]
32+ Sometimes referred to as binary16: uses 1 sign, 5 exponent, and 10
33+ significand bits. Useful when precision is important at the expense of range.
34+ .. [2 ]
35+ Sometimes referred to as Brain Floating Point: use 1 sign, 8 exponent and 7
36+ significand bits. Useful when range is important, since it has the same
37+ number of exponent bits as ``float32 ``
2638
2739:class: `torch.Tensor ` is an alias for the default tensor type (:class: `torch.FloatTensor `).
2840
0 commit comments