2016-12-23 21:28:04 +00:00
|
|
|
torch
|
|
|
|
|
===================================
|
|
|
|
|
.. automodule:: torch
|
|
|
|
|
|
2017-01-05 04:20:57 +00:00
|
|
|
Tensors
|
|
|
|
|
----------------------------------
|
|
|
|
|
.. autofunction:: is_tensor
|
|
|
|
|
.. autofunction:: is_storage
|
|
|
|
|
.. autofunction:: set_default_tensor_type
|
2018-04-16 17:49:00 +00:00
|
|
|
.. autofunction:: set_default_dtype
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: numel
|
2017-03-07 02:52:37 +00:00
|
|
|
.. autofunction:: set_printoptions
|
2018-02-20 00:23:43 +00:00
|
|
|
.. autofunction:: set_flush_denormal
|
2017-01-05 04:20:57 +00:00
|
|
|
|
2018-04-17 20:52:22 +00:00
|
|
|
.. _tensor-creation-ops:
|
2017-01-05 04:20:57 +00:00
|
|
|
|
|
|
|
|
Creation Ops
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
2018-04-19 17:16:07 +00:00
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
Random sampling creation ops are listed under :ref:`random-sampling` and
|
|
|
|
|
include:
|
|
|
|
|
:func:`torch.rand`
|
|
|
|
|
:func:`torch.rand_like`
|
|
|
|
|
:func:`torch.randn`
|
|
|
|
|
:func:`torch.randn_like`
|
|
|
|
|
:func:`torch.randint`
|
|
|
|
|
:func:`torch.randint_like`
|
|
|
|
|
:func:`torch.randperm`
|
|
|
|
|
|
2018-04-17 20:52:22 +00:00
|
|
|
.. autofunction:: tensor
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: from_numpy
|
|
|
|
|
.. autofunction:: zeros
|
2017-08-19 11:34:51 +00:00
|
|
|
.. autofunction:: zeros_like
|
2018-04-17 20:52:22 +00:00
|
|
|
.. autofunction:: ones
|
|
|
|
|
.. autofunction:: ones_like
|
|
|
|
|
.. autofunction:: arange
|
|
|
|
|
.. autofunction:: range
|
|
|
|
|
.. autofunction:: linspace
|
|
|
|
|
.. autofunction:: logspace
|
|
|
|
|
.. autofunction:: eye
|
2018-04-17 18:30:46 +00:00
|
|
|
.. autofunction:: empty
|
2018-03-09 04:02:38 +00:00
|
|
|
.. autofunction:: empty_like
|
2018-04-17 18:30:46 +00:00
|
|
|
.. autofunction:: full
|
|
|
|
|
.. autofunction:: full_like
|
2017-01-05 04:20:57 +00:00
|
|
|
|
|
|
|
|
Indexing, Slicing, Joining, Mutating Ops
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
.. autofunction:: cat
|
2017-01-17 22:40:54 +00:00
|
|
|
.. autofunction:: chunk
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: gather
|
|
|
|
|
.. autofunction:: index_select
|
|
|
|
|
.. autofunction:: masked_select
|
|
|
|
|
.. autofunction:: nonzero
|
2018-03-12 20:20:40 +00:00
|
|
|
.. autofunction:: reshape
|
2017-01-17 22:40:54 +00:00
|
|
|
.. autofunction:: split
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: squeeze
|
2017-01-17 22:40:54 +00:00
|
|
|
.. autofunction:: stack
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: t
|
2017-11-01 10:04:44 +00:00
|
|
|
.. autofunction:: take
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: transpose
|
2017-01-31 20:51:26 +00:00
|
|
|
.. autofunction:: unbind
|
2017-02-23 17:13:25 +00:00
|
|
|
.. autofunction:: unsqueeze
|
2017-12-21 18:55:57 +00:00
|
|
|
.. autofunction:: where
|
2017-01-05 04:20:57 +00:00
|
|
|
|
2018-04-19 17:16:07 +00:00
|
|
|
.. _random-sampling:
|
2017-01-05 04:20:57 +00:00
|
|
|
|
|
|
|
|
Random sampling
|
|
|
|
|
----------------------------------
|
|
|
|
|
.. autofunction:: manual_seed
|
|
|
|
|
.. autofunction:: initial_seed
|
|
|
|
|
.. autofunction:: get_rng_state
|
|
|
|
|
.. autofunction:: set_rng_state
|
|
|
|
|
.. autodata:: default_generator
|
|
|
|
|
.. autofunction:: bernoulli
|
|
|
|
|
.. autofunction:: multinomial
|
|
|
|
|
.. autofunction:: normal
|
2017-09-14 14:03:17 +00:00
|
|
|
.. autofunction:: rand
|
2018-04-19 17:16:07 +00:00
|
|
|
.. autofunction:: rand_like
|
2018-04-11 16:34:25 +00:00
|
|
|
.. autofunction:: randint
|
2018-04-19 17:16:07 +00:00
|
|
|
.. autofunction:: randint_like
|
2017-09-14 14:03:17 +00:00
|
|
|
.. autofunction:: randn
|
2018-04-13 15:33:56 +00:00
|
|
|
.. autofunction:: randn_like
|
2017-09-14 14:03:17 +00:00
|
|
|
.. autofunction:: randperm
|
|
|
|
|
|
|
|
|
|
In-place random sampling
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
There are a few more in-place random sampling functions defined on Tensors as well. Click through to refer to their documentation:
|
|
|
|
|
|
|
|
|
|
- :func:`torch.Tensor.bernoulli_` - in-place version of :func:`torch.bernoulli`
|
|
|
|
|
- :func:`torch.Tensor.cauchy_` - numbers drawn from the Cauchy distribution
|
|
|
|
|
- :func:`torch.Tensor.exponential_` - numbers drawn from the exponential distribution
|
|
|
|
|
- :func:`torch.Tensor.geometric_` - elements drawn from the geometric distribution
|
|
|
|
|
- :func:`torch.Tensor.log_normal_` - samples from the log-normal distribution
|
|
|
|
|
- :func:`torch.Tensor.normal_` - in-place version of :func:`torch.normal`
|
|
|
|
|
- :func:`torch.Tensor.random_` - numbers sampled from the discrete uniform distribution
|
2018-01-09 16:47:48 +00:00
|
|
|
- :func:`torch.Tensor.uniform_` - numbers sampled from the continuous uniform distribution
|
2017-01-05 04:20:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Serialization
|
|
|
|
|
----------------------------------
|
|
|
|
|
.. autofunction:: save
|
|
|
|
|
.. autofunction:: load
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parallelism
|
|
|
|
|
----------------------------------
|
|
|
|
|
.. autofunction:: get_num_threads
|
|
|
|
|
.. autofunction:: set_num_threads
|
|
|
|
|
|
|
|
|
|
|
2016-12-23 21:28:04 +00:00
|
|
|
Math operations
|
|
|
|
|
----------------------------------
|
|
|
|
|
|
2017-01-05 04:20:57 +00:00
|
|
|
Pointwise Ops
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2016-12-23 21:28:04 +00:00
|
|
|
.. autofunction:: abs
|
|
|
|
|
.. autofunction:: acos
|
|
|
|
|
.. autofunction:: add
|
|
|
|
|
.. autofunction:: addcdiv
|
|
|
|
|
.. autofunction:: addcmul
|
|
|
|
|
.. autofunction:: asin
|
|
|
|
|
.. autofunction:: atan
|
|
|
|
|
.. autofunction:: atan2
|
|
|
|
|
.. autofunction:: ceil
|
|
|
|
|
.. autofunction:: clamp
|
|
|
|
|
.. autofunction:: cos
|
|
|
|
|
.. autofunction:: cosh
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: div
|
2017-09-21 01:23:45 +00:00
|
|
|
.. autofunction:: erf
|
|
|
|
|
.. autofunction:: erfinv
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: exp
|
2017-12-28 09:56:03 +00:00
|
|
|
.. autofunction:: expm1
|
2017-01-17 15:03:07 +00:00
|
|
|
.. autofunction:: floor
|
|
|
|
|
.. autofunction:: fmod
|
|
|
|
|
.. autofunction:: frac
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: lerp
|
|
|
|
|
.. autofunction:: log
|
2018-04-05 18:28:37 +00:00
|
|
|
.. autofunction:: log10
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: log1p
|
2018-04-05 18:28:37 +00:00
|
|
|
.. autofunction:: log2
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: mul
|
|
|
|
|
.. autofunction:: neg
|
|
|
|
|
.. autofunction:: pow
|
2017-01-17 02:08:14 +00:00
|
|
|
.. autofunction:: reciprocal
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: remainder
|
|
|
|
|
.. autofunction:: round
|
|
|
|
|
.. autofunction:: rsqrt
|
|
|
|
|
.. autofunction:: sigmoid
|
|
|
|
|
.. autofunction:: sign
|
|
|
|
|
.. autofunction:: sin
|
|
|
|
|
.. autofunction:: sinh
|
|
|
|
|
.. autofunction:: sqrt
|
|
|
|
|
.. autofunction:: tan
|
|
|
|
|
.. autofunction:: tanh
|
|
|
|
|
.. autofunction:: trunc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reduction Ops
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
2018-04-04 19:53:26 +00:00
|
|
|
.. autofunction:: argmax
|
|
|
|
|
.. autofunction:: argmin
|
2016-12-23 21:28:04 +00:00
|
|
|
.. autofunction:: cumprod
|
|
|
|
|
.. autofunction:: cumsum
|
|
|
|
|
.. autofunction:: dist
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: mean
|
|
|
|
|
.. autofunction:: median
|
|
|
|
|
.. autofunction:: mode
|
|
|
|
|
.. autofunction:: norm
|
|
|
|
|
.. autofunction:: prod
|
|
|
|
|
.. autofunction:: std
|
|
|
|
|
.. autofunction:: sum
|
2018-03-07 23:16:51 +00:00
|
|
|
.. autofunction:: unique
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Comparison Ops
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
2016-12-23 21:28:04 +00:00
|
|
|
.. autofunction:: eq
|
|
|
|
|
.. autofunction:: equal
|
|
|
|
|
.. autofunction:: ge
|
|
|
|
|
.. autofunction:: gt
|
2018-02-20 00:46:35 +00:00
|
|
|
.. autofunction:: isnan
|
2016-12-23 21:28:04 +00:00
|
|
|
.. autofunction:: kthvalue
|
|
|
|
|
.. autofunction:: le
|
|
|
|
|
.. autofunction:: lt
|
|
|
|
|
.. autofunction:: max
|
|
|
|
|
.. autofunction:: min
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: ne
|
|
|
|
|
.. autofunction:: sort
|
|
|
|
|
.. autofunction:: topk
|
|
|
|
|
|
|
|
|
|
|
2017-12-18 17:28:23 +00:00
|
|
|
Spectral Ops
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
2018-04-11 02:09:36 +00:00
|
|
|
.. autofunction:: fft
|
|
|
|
|
.. autofunction:: ifft
|
|
|
|
|
.. autofunction:: rfft
|
|
|
|
|
.. autofunction:: irfft
|
2017-12-18 17:28:23 +00:00
|
|
|
.. autofunction:: stft
|
|
|
|
|
.. autofunction:: hann_window
|
|
|
|
|
.. autofunction:: hamming_window
|
|
|
|
|
.. autofunction:: bartlett_window
|
|
|
|
|
|
|
|
|
|
|
2017-01-05 04:20:57 +00:00
|
|
|
Other Operations
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
.. autofunction:: cross
|
|
|
|
|
.. autofunction:: diag
|
2018-03-31 16:03:21 +00:00
|
|
|
.. autofunction:: diagflat
|
|
|
|
|
.. autofunction:: diagonal
|
2018-04-18 11:41:27 +00:00
|
|
|
.. autofunction:: einsum
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: histc
|
|
|
|
|
.. autofunction:: renorm
|
|
|
|
|
.. autofunction:: trace
|
|
|
|
|
.. autofunction:: tril
|
|
|
|
|
.. autofunction:: triu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BLAS and LAPACK Operations
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
.. autofunction:: addbmm
|
|
|
|
|
.. autofunction:: addmm
|
|
|
|
|
.. autofunction:: addmv
|
|
|
|
|
.. autofunction:: addr
|
|
|
|
|
.. autofunction:: baddbmm
|
|
|
|
|
.. autofunction:: bmm
|
2017-03-29 05:29:17 +00:00
|
|
|
.. autofunction:: btrifact
|
2017-12-18 23:26:17 +00:00
|
|
|
.. autofunction:: btrifact_with_info
|
2017-04-02 20:58:46 +00:00
|
|
|
.. autofunction:: btrisolve
|
2017-12-22 19:46:38 +00:00
|
|
|
.. autofunction:: btriunpack
|
2017-01-05 04:20:57 +00:00
|
|
|
.. autofunction:: dot
|
|
|
|
|
.. autofunction:: eig
|
|
|
|
|
.. autofunction:: gels
|
|
|
|
|
.. autofunction:: geqrf
|
|
|
|
|
.. autofunction:: ger
|
|
|
|
|
.. autofunction:: gesv
|
|
|
|
|
.. autofunction:: inverse
|
2017-12-01 18:22:46 +00:00
|
|
|
.. autofunction:: det
|
2018-03-19 18:48:15 +00:00
|
|
|
.. autofunction:: logdet
|
|
|
|
|
.. autofunction:: slogdet
|
2017-06-14 12:14:53 +00:00
|
|
|
.. autofunction:: matmul
|
2016-12-23 21:28:04 +00:00
|
|
|
.. autofunction:: mm
|
|
|
|
|
.. autofunction:: mv
|
|
|
|
|
.. autofunction:: orgqr
|
|
|
|
|
.. autofunction:: ormqr
|
|
|
|
|
.. autofunction:: potrf
|
|
|
|
|
.. autofunction:: potri
|
|
|
|
|
.. autofunction:: potrs
|
|
|
|
|
.. autofunction:: pstrf
|
|
|
|
|
.. autofunction:: qr
|
|
|
|
|
.. autofunction:: svd
|
|
|
|
|
.. autofunction:: symeig
|
|
|
|
|
.. autofunction:: trtrs
|