mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-15 21:00:47 +00:00
[docs] Add docs for storage and tensors for quantized Tensor (#51817)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/51817 Test Plan: Imported from OSS Reviewed By: supriyar Differential Revision: D26292464 Pulled By: jerryzh168 fbshipit-source-id: c5992deda4af949de4ea2e40edee8f22bd59b9e1
This commit is contained in:
parent
fc314350ad
commit
0ec00c1292
2 changed files with 99 additions and 17 deletions
|
|
@ -6,7 +6,83 @@ data type.
|
|||
|
||||
Every :class:`torch.Tensor` has a corresponding storage of the same data type.
|
||||
|
||||
.. autoclass:: torch.DoubleStorage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.FloatStorage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.HalfStorage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.LongStorage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.IntStorage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.ShortStorage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.CharStorage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.ByteStorage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.BoolStorage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.BFloat16Storage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.ComplexDoubleStorage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.ComplexFloatStorage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.QUInt8Storage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.QInt8Storage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.QInt32Storage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: torch.QUInt4x2Storage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:inherited-members:
|
||||
|
||||
|
|
|
|||
|
|
@ -10,23 +10,27 @@ 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 ``torch.float32`` or ``torch.float`` :class:`torch.FloatTensor` :class:`torch.cuda.FloatTensor`
|
||||
64-bit floating point ``torch.float64`` or ``torch.double`` :class:`torch.DoubleTensor` :class:`torch.cuda.DoubleTensor`
|
||||
16-bit floating point [1]_ ``torch.float16`` or ``torch.half`` :class:`torch.HalfTensor` :class:`torch.cuda.HalfTensor`
|
||||
16-bit floating point [2]_ ``torch.bfloat16`` :class:`torch.BFloat16Tensor` :class:`torch.cuda.BFloat16Tensor`
|
||||
32-bit complex ``torch.complex32``
|
||||
64-bit complex ``torch.complex64``
|
||||
128-bit complex ``torch.complex128`` or ``torch.cdouble``
|
||||
8-bit integer (unsigned) ``torch.uint8`` :class:`torch.ByteTensor` :class:`torch.cuda.ByteTensor`
|
||||
8-bit integer (signed) ``torch.int8`` :class:`torch.CharTensor` :class:`torch.cuda.CharTensor`
|
||||
16-bit integer (signed) ``torch.int16`` or ``torch.short`` :class:`torch.ShortTensor` :class:`torch.cuda.ShortTensor`
|
||||
32-bit integer (signed) ``torch.int32`` or ``torch.int`` :class:`torch.IntTensor` :class:`torch.cuda.IntTensor`
|
||||
64-bit integer (signed) ``torch.int64`` or ``torch.long`` :class:`torch.LongTensor` :class:`torch.cuda.LongTensor`
|
||||
Boolean ``torch.bool`` :class:`torch.BoolTensor` :class:`torch.cuda.BoolTensor`
|
||||
========================== =========================================== ============================= ================================
|
||||
======================================= =========================================== ============================= ================================
|
||||
Data type dtype CPU tensor GPU tensor
|
||||
======================================= =========================================== ============================= ================================
|
||||
32-bit floating point ``torch.float32`` or ``torch.float`` :class:`torch.FloatTensor` :class:`torch.cuda.FloatTensor`
|
||||
64-bit floating point ``torch.float64`` or ``torch.double`` :class:`torch.DoubleTensor` :class:`torch.cuda.DoubleTensor`
|
||||
16-bit floating point [1]_ ``torch.float16`` or ``torch.half`` :class:`torch.HalfTensor` :class:`torch.cuda.HalfTensor`
|
||||
16-bit floating point [2]_ ``torch.bfloat16`` :class:`torch.BFloat16Tensor` :class:`torch.cuda.BFloat16Tensor`
|
||||
32-bit complex ``torch.complex32``
|
||||
64-bit complex ``torch.complex64``
|
||||
128-bit complex ``torch.complex128`` or ``torch.cdouble``
|
||||
8-bit integer (unsigned) ``torch.uint8`` :class:`torch.ByteTensor` :class:`torch.cuda.ByteTensor`
|
||||
8-bit integer (signed) ``torch.int8`` :class:`torch.CharTensor` :class:`torch.cuda.CharTensor`
|
||||
16-bit integer (signed) ``torch.int16`` or ``torch.short`` :class:`torch.ShortTensor` :class:`torch.cuda.ShortTensor`
|
||||
32-bit integer (signed) ``torch.int32`` or ``torch.int`` :class:`torch.IntTensor` :class:`torch.cuda.IntTensor`
|
||||
64-bit integer (signed) ``torch.int64`` or ``torch.long`` :class:`torch.LongTensor` :class:`torch.cuda.LongTensor`
|
||||
Boolean ``torch.bool`` :class:`torch.BoolTensor` :class:`torch.cuda.BoolTensor`
|
||||
quantized 8-bit integer (unsigned) ``torch.quint8`` :class:`torch.ByteTensor` /
|
||||
quantized 8-bit integer (signed) ``torch.qint8`` :class:`torch.CharTensor` /
|
||||
quantized 32-bit integer (signed) ``torch.qfint32`` :class:`torch.IntTensor` /
|
||||
quantized 4-bit integer (unsigned) [3]_ ``torch.quint4x2`` :class:`torch.ByteTensor` /
|
||||
======================================= =========================================== ============================= ================================
|
||||
|
||||
.. [1]
|
||||
Sometimes referred to as binary16: uses 1 sign, 5 exponent, and 10
|
||||
|
|
@ -35,6 +39,8 @@ Boolean ``torch.bool`` :class:
|
|||
Sometimes referred to as Brain Floating Point: uses 1 sign, 8 exponent, and 7
|
||||
significand bits. Useful when range is important, since it has the same
|
||||
number of exponent bits as ``float32``
|
||||
.. [3]
|
||||
quantized 4-bit integer is stored as a 8-bit signed integer. Currently it's only supported in EmbeddingBag operator.
|
||||
|
||||
:class:`torch.Tensor` is an alias for the default tensor type (:class:`torch.FloatTensor`).
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue