torch.cuda.init
torch.cuda.init()
Initialize PyTorch's CUDA state.  You may need to call this
   explicitly if you are interacting with PyTorch via its C API, as
   Python bindings for CUDA functionality will not be available until
   this initialization takes place.  Ordinary users should not need
   this, as all of PyTorch's CUDA methods automatically initialize
   CUDA state on-demand.
Does nothing if the CUDA state is already initialized.


torch.Tensor.real
Tensor.real
Returns a new tensor containing real values of the "self" tensor
   for a complex-valued input tensor. The returned tensor and "self"
   share the same underlying storage.
Returns "self" if "self" is a real-valued tensor tensor.
Example::
      >>> x=torch.randn(4, dtype=torch.cfloat)
      >>> x
      tensor([(0.3100+0.3553j), (-0.5445-0.7896j), (-1.6492-0.0633j), (-0.0638-0.8119j)])
      >>> x.real
      tensor([ 0.3100, -0.5445, -1.6492, -0.0638])


torch.signal.windows.bartlett
torch.signal.windows.bartlett(M, *, sym=True, dtype=None, layout=torch.strided, device=None, requires_grad=False)
Computes the Bartlett window.
The Bartlett window is defined as follows:
  w_n = 1 - \left| \frac{2n}{M - 1} - 1 \right| = \begin{cases}
  \frac{2n}{M - 1} & \text{if } 0 \leq n \leq \frac{M - 1}{2} \\
  2 - \frac{2n}{M - 1} & \text{if } \frac{M - 1}{2} < n < M \\
  \end{cases}

The window is normalized to 1 (maximum value is 1). However, the 1
   doesn't appear if "M" is even and "sym" is True.
Parameters:
      M (int) -- the length of the window. In other words, the
      number of points of the returned window.
Keyword Arguments:
      * sym (bool, optional) -- If False, returns a
        periodic window suitable for use in spectral analysis. If
        True, returns a symmetric window suitable for use in filter
        design. Default: True.


design. Default: True.
  * **dtype** ("torch.dtype", optional) -- the desired data type
    of returned tensor. Default: if "None", uses a global default
    (see "torch.set_default_tensor_type()").

  * **layout** ("torch.layout", optional) -- the desired layout of
    returned Tensor. Default: "torch.strided".

  * **device** ("torch.device", optional) -- the desired device of
    returned tensor. Default: if "None", uses the current device
    for the default tensor type (see
    "torch.set_default_tensor_type()"). "device" will be the CPU
    for CPU tensor types and the current CUDA device for CUDA
    tensor types.

  * **requires_grad** (*bool**, **optional*) -- If autograd should
    record operations on the returned tensor. Default: "False".

Return type:
      Tensor
Examples:
  >>> # Generates a symmetric Bartlett window.
  >>> torch.signal.windows.bartlett(10)


torch.signal.windows.bartlett(10)
      tensor([0.0000, 0.2222, 0.4444, 0.6667, 0.8889, 0.8889, 0.6667, 0.4444, 0.2222, 0.0000])

  >>> # Generates a periodic Bartlett window.
  >>> torch.signal.windows.bartlett(10, sym=False)
  tensor([0.0000, 0.2000, 0.4000, 0.6000, 0.8000, 1.0000, 0.8000, 0.6000, 0.4000, 0.2000])


torch.poisson
torch.poisson(input, generator=None) -> Tensor
Returns a tensor of the same size as "input" with each element
   sampled from a Poisson distribution with rate parameter given by
   the corresponding element in "input" i.e.,
  \text{out}_i \sim \text{Poisson}(\text{input}_i)

"input" must be non-negative.
Parameters:
      input (Tensor) -- the input tensor containing the rates of
      the Poisson distribution
Keyword Arguments:
      generator ("torch.Generator", optional) -- a pseudorandom
      number generator for sampling
Example:
  >>> rates = torch.rand(4, 4) * 5  # rate parameter between 0 and 5
  >>> torch.poisson(rates)
  tensor([[9., 1., 3., 5.],
          [8., 6., 6., 0.],
          [0., 4., 5., 3.],
          [2., 1., 4., 2.]])


torch.asin
torch.asin(input, *, out=None) -> Tensor
Returns a new tensor with the arcsine of the elements of "input".
  \text{out}_{i} = \sin^{-1}(\text{input}_{i})

Parameters:
      input (Tensor) -- the input tensor.
Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Example:
  >>> a = torch.randn(4)
  >>> a
  tensor([-0.5962,  1.4985, -0.4396,  1.4525])
  >>> torch.asin(a)
  tensor([-0.6387,     nan, -0.4552,     nan])


torch.Tensor.arcsin_
Tensor.arcsin_() -> Tensor
In-place version of "arcsin()"


torch.Tensor.geqrf
Tensor.geqrf()
See "torch.geqrf()"


torch.Tensor.where
Tensor.where(condition, y) -> Tensor
"self.where(condition, y)" is equivalent to "torch.where(condition,
   self, y)". See "torch.where()"


torch.sym_min
torch.sym_min(a, b)
SymInt-aware utility for max().


torch.index_add
torch.index_add(input, dim, index, source, *, alpha=1, out=None) -> Tensor
See "index_add_()" for function description.


HuberLoss
class torch.nn.HuberLoss(reduction='mean', delta=1.0)
Creates a criterion that uses a squared term if the absolute
   element-wise error falls below delta and a delta-scaled L1 term
   otherwise. This loss combines advantages of both "L1Loss" and
   "MSELoss"; the delta-scaled L1 region makes the loss less sensitive
   to outliers than "MSELoss", while the L2 region provides smoothness
   over "L1Loss" near 0. See Huber loss for more information.
For a batch of size N, the unreduced loss can be described as:
  \ell(x, y) = L = \{l_1, ..., l_N\}^T

with
  l_n = \begin{cases} 0.5 (x_n - y_n)^2, & \text{if } |x_n - y_n|
  < delta \\ delta * (|x_n - y_n| - 0.5 * delta), &
  \text{otherwise } \end{cases}

If reduction is not none, then:
  \ell(x, y) = \begin{cases}     \operatorname{mean}(L), &
  \text{if reduction} = \text{`mean';}\\
  \operatorname{sum}(L),  &  \text{if reduction} = \text{`sum'.}
  \end{cases}

Note:


\end{cases}
Note:
 When delta is set to 1, this loss is equivalent to
 "SmoothL1Loss". In general, this loss differs from "SmoothL1Loss"
 by a factor of delta (AKA beta in Smooth L1). See "SmoothL1Loss"
 for additional discussion on the differences in behavior between
 the two losses.

Parameters:
      * reduction (str, optional) -- Specifies the reduction
        to apply to the output: "'none'" | "'mean'" | "'sum'".
        "'none'": no reduction will be applied, "'mean'": the sum of
        the output will be divided by the number of elements in the
        output, "'sum'": the output will be summed. Default: "'mean'"
  * **delta** (*float**, **optional*) -- Specifies the threshold
    at which to change between delta-scaled L1 and L2 loss. The
    value must be positive.  Default: 1.0

Shape:
      * Input: (*) where * means any number of dimensions.
  * Target: (*), same shape as the input.


Target: (*), same shape as the input.

Output: scalar. If "reduction" is "'none'", then (*), same
    shape as the input.


Module
class torch.nn.Module
Base class for all neural network modules.
Your models should also subclass this class.
Modules can also contain other Modules, allowing to nest them in a
   tree structure. You can assign the submodules as regular
   attributes:
  import torch.nn as nn
  import torch.nn.functional as F

  class Model(nn.Module):
      def __init__(self):
          super().__init__()
          self.conv1 = nn.Conv2d(1, 20, 5)
          self.conv2 = nn.Conv2d(20, 20, 5)

      def forward(self, x):
          x = F.relu(self.conv1(x))
          return F.relu(self.conv2(x))

Submodules assigned in this way will be registered, and will have
   their parameters converted too when you call "to()", etc.
Note:
 As per the example above, an "__init__()" call to the parent
 class must be made before assignment on the child.

Variables:
      training (bool) -- Boolean represents whether this module


is in training or evaluation mode.
add_module(name, module)
  Adds a child module to the current module.

  The module can be accessed as an attribute using the given name.

  Parameters:
     * **name** (*str*) -- name of the child module. The child
       module can be accessed from this module using the given
       name

     * **module** (*Module*) -- child module to be added to the
       module.

apply(fn)
  Applies "fn" recursively to every submodule (as returned by
  ".children()") as well as self. Typical use includes
  initializing the parameters of a model (see also torch.nn.init).

  Parameters:
     **fn** ("Module" -> None) -- function to be applied to each
     submodule

  Returns:
     self

  Return type:
     Module

  Example:

     >>> @torch.no_grad()
     >>> def init_weights(m):
     >>>     print(m)
     >>>     if type(m) == nn.Linear:
     >>>         m.weight.fill_(1.0)


    m.weight.fill_(1.0)
     >>>         print(m.weight)
     >>> net = nn.Sequential(nn.Linear(2, 2), nn.Linear(2, 2))
     >>> net.apply(init_weights)
     Linear(in_features=2, out_features=2, bias=True)
     Parameter containing:
     tensor([[1., 1.],
             [1., 1.]], requires_grad=True)
     Linear(in_features=2, out_features=2, bias=True)
     Parameter containing:
     tensor([[1., 1.],
             [1., 1.]], requires_grad=True)
     Sequential(
       (0): Linear(in_features=2, out_features=2, bias=True)
       (1): Linear(in_features=2, out_features=2, bias=True)
     )

bfloat16()
  Casts all floating point parameters and buffers to "bfloat16"
  datatype.

  Note:

    This method modifies the module in-place.

  Returns:
     self

  Return type:
     Module

buffers(recurse=True)
  Returns an iterator over module buffers.

  Parameters:


Parameters:
         recurse (bool) -- if True, then yields buffers of this
         module and all submodules. Otherwise, yields only buffers
         that are direct members of this module.
  Yields:
     *torch.Tensor* -- module buffer

  Return type:
     *Iterator*[*Tensor*]

  Example:

     >>> for buf in model.buffers():
     >>>     print(type(buf), buf.size())
     <class 'torch.Tensor'> (20L,)
     <class 'torch.Tensor'> (20L, 1L, 5L, 5L)

children()
  Returns an iterator over immediate children modules.

  Yields:
     *Module* -- a child module

  Return type:
     *Iterator*[*Module*]

cpu()
  Moves all model parameters and buffers to the CPU.

  Note:

    This method modifies the module in-place.

  Returns:
     self

  Return type:
     Module

cuda(device=None)
  Moves all model parameters and buffers to the GPU.

  This also makes associated parameters and buffers different


objects. So it should be called before constructing optimizer if
      the module will live on GPU while being optimized.
  Note:

    This method modifies the module in-place.

  Parameters:
     **device** (*int**, **optional*) -- if specified, all
     parameters will be copied to that device

  Returns:
     self

  Return type:
     Module

double()
  Casts all floating point parameters and buffers to "double"
  datatype.

  Note:

    This method modifies the module in-place.

  Returns:
     self

  Return type:
     Module

eval()
  Sets the module in evaluation mode.

  This has any effect only on certain modules. See documentations
  of particular modules for details of their behaviors in
  training/evaluation mode, if they are affected, e.g. "Dropout",
  "BatchNorm", etc.

  This is equivalent with "self.train(False)".

  See Locally disabling gradient computation for a comparison


between .eval() and several similar mechanisms that may be
      confused with it.
  Returns:
     self

  Return type:
     Module

extra_repr()
  Set the extra representation of the module

  To print customized extra information, you should re-implement
  this method in your own modules. Both single-line and multi-line
  strings are acceptable.

  Return type:
     str

float()
  Casts all floating point parameters and buffers to "float"
  datatype.

  Note:

    This method modifies the module in-place.

  Returns:
     self

  Return type:
     Module

forward(*input)
  Defines the computation performed at every call.

  Should be overridden by all subclasses.

  Note:

    Although the recipe for forward pass needs to be defined
    within this function, one should call the "Module" instance
    afterwards instead of this since the former takes care of


running the registered hooks while the latter silently ignores
        them.
get_buffer(target)
  Returns the buffer given by "target" if it exists, otherwise
  throws an error.

  See the docstring for "get_submodule" for a more detailed
  explanation of this method's functionality as well as how to
  correctly specify "target".

  Parameters:
     **target** (*str*) -- The fully-qualified string name of the
     buffer to look for. (See "get_submodule" for how to specify a
     fully-qualified string.)

  Returns:
     The buffer referenced by "target"

  Return type:
     torch.Tensor

  Raises:
     **AttributeError** -- If the target string references an
     invalid     path or resolves to something that is not a
     buffer

get_extra_state()
  Returns any extra state to include in the module's state_dict.
  Implement this and a corresponding "set_extra_state()" for your


module if you need to store extra state. This function is called
      when building the module's state_dict().
  Note that extra state should be picklable to ensure working
  serialization of the state_dict. We only provide provide
  backwards compatibility guarantees for serializing Tensors;
  other objects may break backwards compatibility if their
  serialized pickled form changes.

  Returns:
     Any extra state to store in the module's state_dict

  Return type:
     object

get_parameter(target)
  Returns the parameter given by "target" if it exists, otherwise
  throws an error.

  See the docstring for "get_submodule" for a more detailed
  explanation of this method's functionality as well as how to
  correctly specify "target".

  Parameters:
     **target** (*str*) -- The fully-qualified string name of the
     Parameter to look for. (See "get_submodule" for how to
     specify a fully-qualified string.)


specify a fully-qualified string.)
  Returns:
     The Parameter referenced by "target"

  Return type:
     torch.nn.Parameter

  Raises:
     **AttributeError** -- If the target string references an
     invalid     path or resolves to something that is not an
     "nn.Parameter"

get_submodule(target)
  Returns the submodule given by "target" if it exists, otherwise
  throws an error.

  For example, let's say you have an "nn.Module" "A" that looks
  like this:

     A(
         (net_b): Module(
             (net_c): Module(
                 (conv): Conv2d(16, 33, kernel_size=(3, 3), stride=(2, 2))
             )
             (linear): Linear(in_features=100, out_features=200, bias=True)
         )
     )

  (The diagram shows an "nn.Module" "A". "A" has a nested
  submodule "net_b", which itself has two submodules "net_c" and
  "linear". "net_c" then has a submodule "conv".)


To check whether or not we have the "linear" submodule, we would
      call "get_submodule("net_b.linear")". To check whether we have
      the "conv" submodule, we would call
      "get_submodule("net_b.net_c.conv")".
  The runtime of "get_submodule" is bounded by the degree of
  module nesting in "target". A query against "named_modules"
  achieves the same result, but it is O(N) in the number of
  transitive modules. So, for a simple check to see if some
  submodule exists, "get_submodule" should always be used.

  Parameters:
     **target** (*str*) -- The fully-qualified string name of the
     submodule to look for. (See above example for how to specify
     a fully-qualified string.)

  Returns:
     The submodule referenced by "target"

  Return type:
     torch.nn.Module

  Raises:
     **AttributeError** -- If the target string references an
     invalid     path or resolves to something that is not an
     "nn.Module"


"nn.Module"
half()
  Casts all floating point parameters and buffers to "half"
  datatype.

  Note:

    This method modifies the module in-place.

  Returns:
     self

  Return type:
     Module

ipu(device=None)
  Moves all model parameters and buffers to the IPU.

  This also makes associated parameters and buffers different
  objects. So it should be called before constructing optimizer if
  the module will live on IPU while being optimized.

  Note:

    This method modifies the module in-place.

  Parameters:
     **device** (*int**, **optional*) -- if specified, all
     parameters will be copied to that device

  Returns:
     self

  Return type:
     Module

load_state_dict(state_dict, strict=True)
  Copies parameters and buffers from "state_dict" into this module
  and its descendants. If "strict" is "True", then the keys of


"state_dict" must exactly match the keys returned by this
      module's "state_dict()" function.
  Parameters:
     * **state_dict** (*dict*) -- a dict containing parameters and
       persistent buffers.

     * **strict** (*bool**, **optional*) -- whether to strictly
       enforce that the keys in "state_dict" match the keys
       returned by this module's "state_dict()" function. Default:
       "True"

  Returns:
     * **missing_keys** is a list of str containing the missing
       keys

     * **unexpected_keys** is a list of str containing the
       unexpected keys

  Return type:
     "NamedTuple" with "missing_keys" and "unexpected_keys" fields

  Note:

    If a parameter or buffer is registered as "None" and its
    corresponding key exists in "state_dict", "load_state_dict()"
    will raise a "RuntimeError".

modules()
  Returns an iterator over all modules in the network.

  Yields:


Yields:
         Module -- a module in the network
  Return type:
     *Iterator*[*Module*]

  Note:

    Duplicate modules are returned only once. In the following
    example, "l" will be returned only once.

  Example:

     >>> l = nn.Linear(2, 2)
     >>> net = nn.Sequential(l, l)
     >>> for idx, m in enumerate(net.modules()):
     ...     print(idx, '->', m)

     0 -> Sequential(
       (0): Linear(in_features=2, out_features=2, bias=True)
       (1): Linear(in_features=2, out_features=2, bias=True)
     )
     1 -> Linear(in_features=2, out_features=2, bias=True)

named_buffers(prefix='', recurse=True, remove_duplicate=True)
  Returns an iterator over module buffers, yielding both the name
  of the buffer as well as the buffer itself.

  Parameters:
     * **prefix** (*str*) -- prefix to prepend to all buffer
       names.

     * **recurse** (*bool**, **optional*) -- if True, then yields


buffers of this module and all submodules. Otherwise,
           yields only buffers that are direct members of this module.
           Defaults to True.
     * **remove_duplicate** (*bool**, **optional*) -- whether to
       remove the duplicated buffers in the result. Defaults to
       True.

  Yields:
     *(str, torch.Tensor)* -- Tuple containing the name and buffer

  Return type:
     *Iterator*[*Tuple*[str, *Tensor*]]

  Example:

     >>> for name, buf in self.named_buffers():
     >>>     if name in ['running_var']:
     >>>         print(buf.size())

named_children()
  Returns an iterator over immediate children modules, yielding
  both the name of the module as well as the module itself.

  Yields:
     *(str, Module)* -- Tuple containing a name and child module

  Return type:
     *Iterator*[*Tuple*[str, *Module*]]

  Example:

     >>> for name, module in model.named_children():


if name in ['conv4', 'conv5']:
     >>>         print(module)

named_modules(memo=None, prefix='', remove_duplicate=True)
  Returns an iterator over all modules in the network, yielding
  both the name of the module as well as the module itself.

  Parameters:
     * **memo** (*Optional**[**Set**[**Module**]**]*) -- a memo to
       store the set of modules already added to the result

     * **prefix** (*str*) -- a prefix that will be added to the
       name of the module

     * **remove_duplicate** (*bool*) -- whether to remove the
       duplicated module instances in the result or not

  Yields:
     *(str, Module)* -- Tuple of name and module

  Note:

    Duplicate modules are returned only once. In the following
    example, "l" will be returned only once.

  Example:

     >>> l = nn.Linear(2, 2)
     >>> net = nn.Sequential(l, l)
     >>> for idx, m in enumerate(net.named_modules()):


...     print(idx, '->', m)
     0 -> ('', Sequential(
       (0): Linear(in_features=2, out_features=2, bias=True)
       (1): Linear(in_features=2, out_features=2, bias=True)
     ))
     1 -> ('0', Linear(in_features=2, out_features=2, bias=True))

named_parameters(prefix='', recurse=True, remove_duplicate=True)
  Returns an iterator over module parameters, yielding both the
  name of the parameter as well as the parameter itself.

  Parameters:
     * **prefix** (*str*) -- prefix to prepend to all parameter
       names.

     * **recurse** (*bool*) -- if True, then yields parameters of
       this module and all submodules. Otherwise, yields only
       parameters that are direct members of this module.

     * **remove_duplicate** (*bool**, **optional*) -- whether to
       remove the duplicated parameters in the result. Defaults to
       True.

  Yields:


True.
  Yields:
     *(str, Parameter)* -- Tuple containing the name and parameter

  Return type:
     *Iterator*[*Tuple*[str, *Parameter*]]

  Example:

     >>> for name, param in self.named_parameters():
     >>>     if name in ['bias']:
     >>>         print(param.size())

parameters(recurse=True)
  Returns an iterator over module parameters.

  This is typically passed to an optimizer.

  Parameters:
     **recurse** (*bool*) -- if True, then yields parameters of
     this module and all submodules. Otherwise, yields only
     parameters that are direct members of this module.

  Yields:
     *Parameter* -- module parameter

  Return type:
     *Iterator*[*Parameter*]

  Example:

     >>> for param in model.parameters():
     >>>     print(type(param), param.size())
     <class 'torch.Tensor'> (20L,)
     <class 'torch.Tensor'> (20L, 1L, 5L, 5L)

register_backward_hook(hook)


register_backward_hook(hook)
  Registers a backward hook on the module.

  This function is deprecated in favor of
  "register_full_backward_hook()" and the behavior of this
  function will change in future versions.

  Returns:
     a handle that can be used to remove the added hook by calling
     "handle.remove()"

  Return type:
     "torch.utils.hooks.RemovableHandle"

register_buffer(name, tensor, persistent=True)
  Adds a buffer to the module.

  This is typically used to register a buffer that should not to
  be considered a model parameter. For example, BatchNorm's
  "running_mean" is not a parameter, but is part of the module's
  state. Buffers, by default, are persistent and will be saved
  alongside parameters. This behavior can be changed by setting
  "persistent" to "False". The only difference between a
  persistent buffer and a non-persistent buffer is that the latter


will not be a part of this module's "state_dict".
  Buffers can be accessed as attributes using given names.

  Parameters:
     * **name** (*str*) -- name of the buffer. The buffer can be
       accessed from this module using the given name

     * **tensor** (*Tensor** or **None*) -- buffer to be
       registered. If "None", then operations that run on buffers,
       such as "cuda", are ignored. If "None", the buffer is
       **not** included in the module's "state_dict".

     * **persistent** (*bool*) -- whether the buffer is part of
       this module's "state_dict".

  Example:

     >>> self.register_buffer('running_mean', torch.zeros(num_features))

register_forward_hook(hook, *, prepend=False, with_kwargs=False)
  Registers a forward hook on the module.

  The hook will be called every time after "forward()" has
  computed an output.

  If "with_kwargs" is "False" or not specified, the input contains


only the positional arguments given to the module. Keyword
      arguments won't be passed to the hooks and only to the
      "forward". The hook can modify the output. It can modify the
      input inplace but it will not have effect on forward since this
      is called after "forward()" is called. The hook should have the
      following signature:
     hook(module, args, output) -> None or modified output

  If "with_kwargs" is "True", the forward hook will be passed the
  "kwargs" given to the forward function and be expected to return
  the output possibly modified. The hook should have the following
  signature:

     hook(module, args, kwargs, output) -> None or modified output

  Parameters:
     * **hook** (*Callable*) -- The user defined hook to be
       registered.

     * **prepend** (*bool*) -- If "True", the provided "hook" will
       be fired before all existing "forward" hooks on this


"torch.nn.modules.Module". Otherwise, the provided "hook"
           will be fired after all existing "forward" hooks on this
           "torch.nn.modules.Module". Note that global "forward" hooks
           registered with "register_module_forward_hook()" will fire
           before all hooks registered by this method. Default:
           "False"
     * **with_kwargs** (*bool*) -- If "True", the "hook" will be
       passed the kwargs given to the forward function. Default:
       "False"

  Returns:
     a handle that can be used to remove the added hook by calling
     "handle.remove()"

  Return type:
     "torch.utils.hooks.RemovableHandle"

register_forward_pre_hook(hook, *, prepend=False, with_kwargs=False)
  Registers a forward pre-hook on the module.

  The hook will be called every time before "forward()" is
  invoked.

  If "with_kwargs" is false or not specified, the input contains


only the positional arguments given to the module. Keyword
      arguments won't be passed to the hooks and only to the
      "forward". The hook can modify the input. User can either return
      a tuple or a single modified value in the hook. We will wrap the
      value into a tuple if a single value is returned (unless that
      value is already a tuple). The hook should have the following
      signature:
     hook(module, args) -> None or modified input

  If "with_kwargs" is true, the forward pre-hook will be passed
  the kwargs given to the forward function. And if the hook
  modifies the input, both the args and kwargs should be returned.
  The hook should have the following signature:

     hook(module, args, kwargs) -> None or a tuple of modified input and kwargs

  Parameters:
     * **hook** (*Callable*) -- The user defined hook to be
       registered.

     * **prepend** (*bool*) -- If true, the provided "hook" will


be fired before all existing "forward_pre" hooks on this
           "torch.nn.modules.Module". Otherwise, the provided "hook"
           will be fired after all existing "forward_pre" hooks on
           this "torch.nn.modules.Module". Note that global
           "forward_pre" hooks registered with
           "register_module_forward_pre_hook()" will fire before all
           hooks registered by this method. Default: "False"
     * **with_kwargs** (*bool*) -- If true, the "hook" will be
       passed the kwargs given to the forward function. Default:
       "False"

  Returns:
     a handle that can be used to remove the added hook by calling
     "handle.remove()"

  Return type:
     "torch.utils.hooks.RemovableHandle"

register_full_backward_hook(hook, prepend=False)
  Registers a backward hook on the module.

  The hook will be called every time the gradients with respect to
  a module are computed, i.e. the hook will execute if and only if


the gradients with respect to module outputs are computed. The
      hook should have the following signature:
     hook(module, grad_input, grad_output) -> tuple(Tensor) or None

  The "grad_input" and "grad_output" are tuples that contain the
  gradients with respect to the inputs and outputs respectively.
  The hook should not modify its arguments, but it can optionally
  return a new gradient with respect to the input that will be
  used in place of "grad_input" in subsequent computations.
  "grad_input" will only correspond to the inputs given as
  positional arguments and all kwarg arguments are ignored.
  Entries in "grad_input" and "grad_output" will be "None" for all
  non-Tensor arguments.

  For technical reasons, when this hook is applied to a Module,
  its forward function will receive a view of each Tensor passed
  to the Module. Similarly the caller will receive a view of each
  Tensor returned by the Module's forward function.


Warning:
    Modifying inputs or outputs inplace is not allowed when using
    backward hooks and will raise an error.

  Parameters:
     * **hook** (*Callable*) -- The user-defined hook to be
       registered.

     * **prepend** (*bool*) -- If true, the provided "hook" will
       be fired before all existing "backward" hooks on this
       "torch.nn.modules.Module". Otherwise, the provided "hook"
       will be fired after all existing "backward" hooks on this
       "torch.nn.modules.Module". Note that global "backward"
       hooks registered with
       "register_module_full_backward_hook()" will fire before all
       hooks registered by this method.

  Returns:
     a handle that can be used to remove the added hook by calling
     "handle.remove()"

  Return type:
     "torch.utils.hooks.RemovableHandle"

register_full_backward_pre_hook(hook, prepend=False)
  Registers a backward pre-hook on the module.


The hook will be called every time the gradients for the module
      are computed. The hook should have the following signature:
     hook(module, grad_output) -> Tensor or None

  The "grad_output" is a tuple. The hook should not modify its
  arguments, but it can optionally return a new gradient with
  respect to the output that will be used in place of
  "grad_output" in subsequent computations. Entries in
  "grad_output" will be "None" for all non-Tensor arguments.

  For technical reasons, when this hook is applied to a Module,
  its forward function will receive a view of each Tensor passed
  to the Module. Similarly the caller will receive a view of each
  Tensor returned by the Module's forward function.

  Warning:

    Modifying inputs inplace is not allowed when using backward
    hooks and will raise an error.

  Parameters:
     * **hook** (*Callable*) -- The user-defined hook to be
       registered.


registered.
     * **prepend** (*bool*) -- If true, the provided "hook" will
       be fired before all existing "backward_pre" hooks on this
       "torch.nn.modules.Module". Otherwise, the provided "hook"
       will be fired after all existing "backward_pre" hooks on
       this "torch.nn.modules.Module". Note that global
       "backward_pre" hooks registered with
       "register_module_full_backward_pre_hook()" will fire before
       all hooks registered by this method.

  Returns:
     a handle that can be used to remove the added hook by calling
     "handle.remove()"

  Return type:
     "torch.utils.hooks.RemovableHandle"

register_load_state_dict_post_hook(hook)
  Registers a post hook to be run after module's "load_state_dict"
  is called.

  It should have the following signature::
     hook(module, incompatible_keys) -> None

  The "module" argument is the current module that this hook is


registered on, and the "incompatible_keys" argument is a
      "NamedTuple" consisting of attributes "missing_keys" and
      "unexpected_keys". "missing_keys" is a "list" of "str"
      containing the missing keys and "unexpected_keys" is a "list" of
      "str" containing the unexpected keys.
  The given incompatible_keys can be modified inplace if needed.

  Note that the checks performed when calling "load_state_dict()"
  with "strict=True" are affected by modifications the hook makes
  to "missing_keys" or "unexpected_keys", as expected. Additions
  to either set of keys will result in an error being thrown when
  "strict=True", and clearing out both missing and unexpected keys
  will avoid an error.

  Returns:
     a handle that can be used to remove the added hook by calling
     "handle.remove()"

  Return type:
     "torch.utils.hooks.RemovableHandle"

register_module(name, module)
  Alias for "add_module()".


Alias for "add_module()".
register_parameter(name, param)
  Adds a parameter to the module.

  The parameter can be accessed as an attribute using given name.

  Parameters:
     * **name** (*str*) -- name of the parameter. The parameter
       can be accessed from this module using the given name

     * **param** (*Parameter** or **None*) -- parameter to be
       added to the module. If "None", then operations that run on
       parameters, such as "cuda", are ignored. If "None", the
       parameter is **not** included in the module's "state_dict".

register_state_dict_pre_hook(hook)
  These hooks will be called with arguments: "self", "prefix", and
  "keep_vars" before calling "state_dict" on "self". The
  registered hooks can be used to perform pre-processing before
  the "state_dict" call is made.

requires_grad_(requires_grad=True)
  Change if autograd should record operations on parameters in
  this module.


this module.
  This method sets the parameters' "requires_grad" attributes in-
  place.

  This method is helpful for freezing part of the module for
  finetuning or training parts of a model individually (e.g., GAN
  training).

  See Locally disabling gradient computation for a comparison
  between *.requires_grad_()* and several similar mechanisms that
  may be confused with it.

  Parameters:
     **requires_grad** (*bool*) -- whether autograd should record
     operations on parameters in this module. Default: "True".

  Returns:
     self

  Return type:
     Module

set_extra_state(state)
  This function is called from "load_state_dict()" to handle any
  extra state found within the *state_dict*. Implement this
  function and a corresponding "get_extra_state()" for your module
  if you need to store extra state within its *state_dict*.

  Parameters:


Parameters:
         state (dict) -- Extra state from the state_dict
share_memory()
  See "torch.Tensor.share_memory_()"

  Return type:
     *T*

state_dict(, destination: T_destination, prefix: str = '', keep_vars: bool = False) -> T_destination
   state_dict(, prefix: str = '', keep_vars: bool = False) -> Dict[str, Any]
  Returns a dictionary containing references to the whole state of
  the module.

  Both parameters and persistent buffers (e.g. running averages)
  are included. Keys are corresponding parameter and buffer names.
  Parameters and buffers set to "None" are not included.

  Note:

    The returned object is a shallow copy. It contains references
    to the module's parameters and buffers.

  Warning:

    Currently "state_dict()" also accepts positional arguments for
    "destination", "prefix" and "keep_vars" in order. However,
    this is being deprecated and keyword arguments will be


enforced in future releases.
  Warning:

    Please avoid the use of argument "destination" as it is not
    designed for end-users.

  Parameters:
     * **destination** (*dict**, **optional*) -- If provided, the
       state of module will be updated into the dict and the same
       object is returned. Otherwise, an "OrderedDict" will be
       created and returned. Default: "None".

     * **prefix** (*str**, **optional*) -- a prefix added to
       parameter and buffer names to compose the keys in
       state_dict. Default: "''".

     * **keep_vars** (*bool**, **optional*) -- by default the
       "Tensor" s returned in the state dict are detached from
       autograd. If it's set to "True", detaching will not be
       performed. Default: "False".

  Returns:
     a dictionary containing a whole state of the module

  Return type:
     dict

  Example:

     >>> module.state_dict().keys()


module.state_dict().keys()
         ['bias', 'weight']

to(device: Optional[Union[int, device]] = ..., dtype: Optional[Union[dtype, str]] = ..., non_blocking: bool = ...) -> T
   to(dtype: Union[dtype, str], non_blocking: bool = ...) -> T
   to(tensor: Tensor, non_blocking: bool = ...) -> T
  Moves and/or casts the parameters and buffers.

  This can be called as

  to(device=None, dtype=None, non_blocking=False)

  to(dtype, non_blocking=False)

  to(tensor, non_blocking=False)

  to(memory_format=torch.channels_last)

  Its signature is similar to "torch.Tensor.to()", but only
  accepts floating point or complex "dtype"s. In addition, this
  method will only cast the floating point or complex parameters
  and buffers to "dtype" (if given). The integral parameters and
  buffers will be moved "device", if that is given, but with
  dtypes unchanged. When "non_blocking" is set, it tries to


convert/move asynchronously with respect to the host if
      possible, e.g., moving CPU Tensors with pinned memory to CUDA
      devices.
  See below for examples.

  Note:

    This method modifies the module in-place.

  Parameters:
     * **device** ("torch.device") -- the desired device of the
       parameters and buffers in this module

     * **dtype** ("torch.dtype") -- the desired floating point or
       complex dtype of the parameters and buffers in this module

     * **tensor** (*torch.Tensor*) -- Tensor whose dtype and
       device are the desired dtype and device for all parameters
       and buffers in this module

     * **memory_format** ("torch.memory_format") -- the desired
       memory format for 4D parameters and buffers in this module
       (keyword only argument)

  Returns:
     self

  Return type:
     Module

  Examples:

     >>> linear = nn.Linear(2, 2)
     >>> linear.weight


linear.weight
         Parameter containing:
         tensor([[ 0.1913, -0.3420],
                 [-0.5113, -0.2325]])
         >>> linear.to(torch.double)
         Linear(in_features=2, out_features=2, bias=True)
         >>> linear.weight
         Parameter containing:
         tensor([[ 0.1913, -0.3420],
                 [-0.5113, -0.2325]], dtype=torch.float64)
         >>> gpu1 = torch.device("cuda:1")
         >>> linear.to(gpu1, dtype=torch.half, non_blocking=True)
         Linear(in_features=2, out_features=2, bias=True)
         >>> linear.weight
         Parameter containing:
         tensor([[ 0.1914, -0.3420],
                 [-0.5112, -0.2324]], dtype=torch.float16, device='cuda:1')
         >>> cpu = torch.device("cpu")
         >>> linear.to(cpu)
         Linear(in_features=2, out_features=2, bias=True)
         >>> linear.weight
         Parameter containing:
         tensor([[ 0.1914, -0.3420],
                 [-0.5112, -0.2324]], dtype=torch.float16)


linear = nn.Linear(2, 2, bias=None).to(torch.cdouble)
         >>> linear.weight
         Parameter containing:
         tensor([[ 0.3741+0.j,  0.2382+0.j],
                 [ 0.5593+0.j, -0.4443+0.j]], dtype=torch.complex128)
         >>> linear(torch.ones(3, 2, dtype=torch.cdouble))
         tensor([[0.6122+0.j, 0.1150+0.j],
                 [0.6122+0.j, 0.1150+0.j],
                 [0.6122+0.j, 0.1150+0.j]], dtype=torch.complex128)

to_empty(*, device)
  Moves the parameters and buffers to the specified device without
  copying storage.

  Parameters:
     **device** ("torch.device") -- The desired device of the
     parameters and buffers in this module.

  Returns:
     self

  Return type:
     Module

train(mode=True)
  Sets the module in training mode.

  This has any effect only on certain modules. See documentations
  of particular modules for details of their behaviors in


training/evaluation mode, if they are affected, e.g. "Dropout",
      "BatchNorm", etc.
  Parameters:
     **mode** (*bool*) -- whether to set training mode ("True") or
     evaluation mode ("False"). Default: "True".

  Returns:
     self

  Return type:
     Module

type(dst_type)
  Casts all parameters and buffers to "dst_type".

  Note:

    This method modifies the module in-place.

  Parameters:
     **dst_type** (*type** or **string*) -- the desired type

  Returns:
     self

  Return type:
     Module

xpu(device=None)
  Moves all model parameters and buffers to the XPU.

  This also makes associated parameters and buffers different
  objects. So it should be called before constructing optimizer if
  the module will live on XPU while being optimized.

  Note:

    This method modifies the module in-place.

  Parameters:
     **device** (*int**, **optional*) -- if specified, all


parameters will be copied to that device
  Returns:
     self

  Return type:
     Module

zero_grad(set_to_none=False)
  Sets gradients of all model parameters to zero. See similar
  function under "torch.optim.Optimizer" for more context.

  Parameters:
     **set_to_none** (*bool*) -- instead of setting to zero, set
     the grads to None. See "torch.optim.Optimizer.zero_grad()"
     for details.


torch.meshgrid
torch.meshgrid(*tensors, indexing=None)
Creates grids of coordinates specified by the 1D inputs in
   attr:tensors.
This is helpful when you want to visualize data over some range of
   inputs. See below for a plotting example.
Given N 1D tensors T_0 \ldots T_{N-1} as inputs with corresponding
   sizes S_0 \ldots S_{N-1}, this creates N N-dimensional tensors G_0
   \ldots G_{N-1}, each with shape (S_0, ..., S_{N-1}) where the
   output G_i is constructed by expanding T_i to the result shape.
Note:
 0D inputs are treated equivalently to 1D inputs of a single
 element.

Warning:
 *torch.meshgrid(*tensors)* currently has the same behavior as
 calling *numpy.meshgrid(*arrays, indexing='ij')*.In the future
 *torch.meshgrid* will transition to *indexing='xy'* as the
 default.https://github.com/pytorch/pytorch/issues/50276 tracks
 this issue with the goal of migrating to NumPy's behavior.

See also:


See also:
 "torch.cartesian_prod()" has the same effect but it collects the
 data in a tensor of vectors.

Parameters:
      * tensors (list of Tensor) -- list of scalars or 1
        dimensional tensors. Scalars will be treated as tensors of
        size (1,) automatically
  * **indexing** (*Optional**[**str**]*) --

    (str, optional): the indexing mode, either "xy" or "ij",
    defaults to "ij". See warning for future changes.

    If "xy" is selected, the first dimension corresponds to the
    cardinality of the second input and the second dimension
    corresponds to the cardinality of the first input.

    If "ij" is selected, the dimensions are in the same order as
    the cardinality of the inputs.

Returns:
      If the input has N tensors of size S_0 \ldots S_{N-1}`, then the
      output will also have N tensors, where each tensor is of shape
      (S_0, ..., S_{N-1}).
Return type:
      seq (sequence of Tensors)
Example:


seq (sequence of Tensors)
Example:
  >>> x = torch.tensor([1, 2, 3])
  >>> y = torch.tensor([4, 5, 6])

  Observe the element-wise pairings across the grid, (1, 4),
  (1, 5), ..., (3, 6). This is the same thing as the
  cartesian product.
  >>> grid_x, grid_y = torch.meshgrid(x, y, indexing='ij')
  >>> grid_x
  tensor([[1, 1, 1],
          [2, 2, 2],
          [3, 3, 3]])
  >>> grid_y
  tensor([[4, 5, 6],
          [4, 5, 6],
          [4, 5, 6]])

  This correspondence can be seen when these grids are
  stacked properly.
  >>> torch.equal(torch.cat(tuple(torch.dstack([grid_x, grid_y]))),
  ...             torch.cartesian_prod(x, y))
  True

  `torch.meshgrid` is commonly used to produce a grid for
  plotting.
  >>> import matplotlib.pyplot as plt
  >>> xs = torch.linspace(-5, 5, steps=100)
  >>> ys = torch.linspace(-5, 5, steps=100)
  >>> x, y = torch.meshgrid(xs, ys, indexing='xy')


z = torch.sin(torch.sqrt(x * x + y * y))
      >>> ax = plt.axes(projection='3d')
      >>> ax.plot_surface(x.numpy(), y.numpy(), z.numpy())
      >>> plt.show()

[image]


torch.nn.functional.dropout3d
torch.nn.functional.dropout3d(input, p=0.5, training=True, inplace=False)
Randomly zero out entire channels (a channel is a 3D feature map,
   e.g., the j-th channel of the i-th sample in the batched input is a
   3D tensor \text{input}[i, j]) of the input tensor). Each channel
   will be zeroed out independently on every forward call with
   probability "p" using samples from a Bernoulli distribution.
See "Dropout3d" for details.
Parameters:
      * p (float) -- probability of a channel to be zeroed.
        Default: 0.5
  * **training** (*bool*) -- apply dropout if is "True". Default:
    "True"

  * **inplace** (*bool*) -- If set to "True", will do this
    operation in-place. Default: "False"

Return type:
      Tensor


MSELoss
class torch.nn.MSELoss(size_average=None, reduce=None, reduction='mean')
Creates a criterion that measures the mean squared error (squared
   L2 norm) between each element in the input x and target y.
The unreduced (i.e. with "reduction" set to "'none'") loss can be
   described as:
  \ell(x, y) = L = \{l_1,\dots,l_N\}^\top, \quad l_n = \left( x_n
  - y_n \right)^2,

where N is the batch size. If "reduction" is not "'none'" (default
   "'mean'"), then:
  \ell(x, y) = \begin{cases}     \operatorname{mean}(L), &
  \text{if reduction} = \text{`mean';}\\
  \operatorname{sum}(L),  &  \text{if reduction} = \text{`sum'.}
  \end{cases}

x and y are tensors of arbitrary shapes with a total of n elements
   each.
The mean operation still operates over all the elements, and
   divides by n.
The division by n can be avoided if one sets "reduction = 'sum'".
Parameters:
      * size_average (bool, optional) -- Deprecated (see


"reduction"). By default, the losses are averaged over each
        loss element in the batch. Note that for some losses, there
        are multiple elements per sample. If the field "size_average"
        is set to "False", the losses are instead summed for each
        minibatch. Ignored when "reduce" is "False". Default: "True"
  * **reduce** (*bool**, **optional*) -- Deprecated (see
    "reduction"). By default, the losses are averaged or summed
    over observations for each minibatch depending on
    "size_average". When "reduce" is "False", returns a loss per
    batch element instead and ignores "size_average". Default:
    "True"

  * **reduction** (*str**, **optional*) -- Specifies the reduction
    to apply to the output: "'none'" | "'mean'" | "'sum'".
    "'none'": no reduction will be applied, "'mean'": the sum of
    the output will be divided by the number of elements in the
    output, "'sum'": the output will be summed. Note:


"size_average" and "reduce" are in the process of being
        deprecated, and in the meantime, specifying either of those
        two args will override "reduction". Default: "'mean'"
Shape:
      * Input: (*), where * means any number of dimensions.
  * Target: (*), same shape as the input.

Examples:
  >>> loss = nn.MSELoss()
  >>> input = torch.randn(3, 5, requires_grad=True)
  >>> target = torch.randn(3, 5)
  >>> output = loss(input, target)
  >>> output.backward()


torch.seed
torch.seed()
Sets the seed for generating random numbers to a non-deterministic
   random number. Returns a 64 bit number used to seed the RNG.
Return type:
      int


torch.linalg.eigh
torch.linalg.eigh(A, UPLO='L', *, out=None)
Computes the eigenvalue decomposition of a complex Hermitian or
   real symmetric matrix.
Letting \mathbb{K} be \mathbb{R} or \mathbb{C}, the eigenvalue
   decomposition of a complex Hermitian or real symmetric matrix A
   \in \mathbb{K}^{n \times n} is defined as
  A = Q \operatorname{diag}(\Lambda) Q^{\text{H}}\mathrlap{\qquad
  Q \in \mathbb{K}^{n \times n}, \Lambda \in \mathbb{R}^n}

where Q^{\text{H}} is the conjugate transpose when Q is complex,
   and the transpose when Q is real-valued. Q is orthogonal in the
   real case and unitary in the complex case.
Supports input of float, double, cfloat and cdouble dtypes. Also
   supports batches of matrices, and if "A" is a batch of matrices
   then the output has the same batch dimensions.
"A" is assumed to be Hermitian (resp. symmetric), but this is not
   checked internally, instead:


checked internally, instead:

If "UPLO"= 'L' (default), only the lower triangular part of the
     matrix is used in the computation.

If "UPLO"= 'U', only the upper triangular part of the matrix is
     used.

The eigenvalues are returned in ascending order.
Note:
 When inputs are on a CUDA device, this function synchronizes that
 device with the CPU.

Note:
 The eigenvalues of real symmetric or complex Hermitian matrices
 are always real.

Warning:
 The eigenvectors of a symmetric matrix are not unique, nor are
 they continuous with respect to "A". Due to this lack of
 uniqueness, different hardware and software may compute different
 eigenvectors.This non-uniqueness is caused by the fact that
 multiplying an eigenvector by *-1* in the real case or by e^{i
 \phi}, \phi \in \mathbb{R} in the complex case produces another
 set of valid eigenvectors of the matrix. For this reason, the


loss function shall not depend on the phase of the eigenvectors,
     as this quantity is not well-defined. This is checked for complex
     inputs when computing the gradients of this function. As such,
     when inputs are complex and are on a CUDA device, the computation
     of the gradients of this function synchronizes that device with
     the CPU.
Warning:
 Gradients computed using the *eigenvectors* tensor will only be
 finite when "A" has distinct eigenvalues. Furthermore, if the
 distance between any two eigenvalues is close to zero, the
 gradient will be numerically unstable, as it depends on the
 eigenvalues \lambda_i through the computation of \frac{1}{\min_{i
 \neq j} \lambda_i - \lambda_j}.

See also:
 "torch.linalg.eigvalsh()" computes only the eigenvalues of a
 Hermitian matrix. Unlike "torch.linalg.eigh()", the gradients of
 "eigvalsh()" are always numerically stable.

 "torch.linalg.cholesky()" for a different decomposition of a


Hermitian matrix. The Cholesky decomposition gives less
     information about the matrix but is much faster to compute than
     the eigenvalue decomposition.
 "torch.linalg.eig()" for a (slower) function that computes the
 eigenvalue decomposition of a not necessarily Hermitian square
 matrix.

 "torch.linalg.svd()" for a (slower) function that computes the
 more general SVD decomposition of matrices of any shape.

 "torch.linalg.qr()" for another (much faster) decomposition that
 works on general matrices.

Parameters:
      * A (Tensor) -- tensor of shape (, n, n)* where *** is
        zero or more batch dimensions consisting of symmetric or
        Hermitian matrices.
  * **UPLO** (*'L'**, **'U'**, **optional*) -- controls whether to
    use the upper or lower triangular part of "A" in the
    computations. Default: *'L'*.

Keyword Arguments:
      out (tuple, optional) -- output tuple of two tensors.


Ignored if None. Default: None.
Returns:
      A named tuple (eigenvalues, eigenvectors) which corresponds to
      \Lambda and Q above.
  *eigenvalues* will always be real-valued, even when "A" is
  complex. It will also be ordered in ascending order.

  *eigenvectors* will have the same dtype as "A" and will contain
  the eigenvectors as its columns.

Examples::
      >>> A = torch.randn(2, 2, dtype=torch.complex128)
      >>> A = A + A.T.conj()  # creates a Hermitian matrix
      >>> A
      tensor([[2.9228+0.0000j, 0.2029-0.0862j],
              [0.2029+0.0862j, 0.3464+0.0000j]], dtype=torch.complex128)
      >>> L, Q = torch.linalg.eigh(A)
      >>> L
      tensor([0.3277, 2.9415], dtype=torch.float64)
      >>> Q
      tensor([[-0.0846+-0.0000j, -0.9964+0.0000j],
              [ 0.9170+0.3898j, -0.0779-0.0331j]], dtype=torch.complex128)
      >>> torch.dist(Q @ torch.diag(L.cdouble()) @ Q.T.conj(), A)
      tensor(6.1062e-16, dtype=torch.float64)


tensor(6.1062e-16, dtype=torch.float64)
  >>> A = torch.randn(3, 2, 2, dtype=torch.float64)
  >>> A = A + A.mT  # creates a batch of symmetric matrices
  >>> L, Q = torch.linalg.eigh(A)
  >>> torch.dist(Q @ torch.diag_embed(L) @ Q.mH, A)
  tensor(1.5423e-15, dtype=torch.float64)


torch.Tensor.index_fill
Tensor.index_fill(dim, index, value) -> Tensor
Out-of-place version of "torch.Tensor.index_fill_()".


torch.Tensor.addmm
Tensor.addmm(mat1, mat2, *, beta=1, alpha=1) -> Tensor
See "torch.addmm()"


torch.autograd.forward_ad.unpack_dual
torch.autograd.forward_ad.unpack_dual(tensor, *, level=None)
Unpacks a "dual tensor" to get both its Tensor value and its
   forward AD gradient. The result is a namedtuple "(primal, tangent)"
   where "primal" is a view of "tensor"'s primal and "tangent" is
   "tensor"'s tangent as-is. Neither of these tensors can be dual
   tensor of level "level".
This function is backward differentiable.
Example:
  >>> with dual_level():
  ...     inp = make_dual(x, x_t)
  ...     out = f(inp)
  ...     y, jvp = unpack_dual(out)
  ...     jvp = unpack_dual(out).tangent

Please see the forward-mode AD tutorial for detailed steps on how
   to use this API.


torch.nn.functional.normalize
torch.nn.functional.normalize(input, p=2.0, dim=1, eps=1e-12, out=None)
Performs L_p normalization of inputs over specified dimension.
For a tensor "input" of sizes (n_0, ..., n_{dim}, ..., n_k), each
   n_{dim} -element vector v along dimension "dim" is transformed as
  v = \frac{v}{\max(\lVert v \rVert_p, \epsilon)}.

With the default arguments it uses the Euclidean norm over vectors
   along dimension 1 for normalization.
Parameters:
      * input (Tensor) -- input tensor of any shape
  * **p** (*float*) -- the exponent value in the norm formulation.
    Default: 2

  * **dim** (*int*) -- the dimension to reduce. Default: 1

  * **eps** (*float*) -- small value to avoid division by zero.
    Default: 1e-12

  * **out** (*Tensor**, **optional*) -- the output tensor. If
    "out" is used, this operation won't be differentiable.

Return type:
      Tensor


torch.nn.functional.conv3d
torch.nn.functional.conv3d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1) -> Tensor
Applies a 3D convolution over an input image composed of several
   input planes.
This operator supports TensorFloat32.
See "Conv3d" for details and output shape.
Note:
 In some circumstances when given tensors on a CUDA device and
 using CuDNN, this operator may select a nondeterministic
 algorithm to increase performance. If this is undesirable, you
 can try to make the operation deterministic (potentially at a
 performance cost) by setting "torch.backends.cudnn.deterministic
 = True". See Reproducibility for more information.

Note:
 This operator supports complex data types i.e. "complex32,
 complex64, complex128".

Parameters:
      * input -- input tensor of shape (\text{minibatch} ,
        \text{in_channels} , iT , iH , iW)


\text{in_channels} , iT , iH , iW)
  * **weight** -- filters of shape (\text{out\_channels} ,
    \frac{\text{in\_channels}}{\text{groups}} , kT , kH , kW)

  * **bias** -- optional bias tensor of shape
    (\text{out\_channels}). Default: None

  * **stride** -- the stride of the convolving kernel. Can be a
    single number or a tuple *(sT, sH, sW)*. Default: 1

  * **padding** --

    implicit paddings on both sides of the input. Can be a string
    {'valid', 'same'}, single number or a tuple *(padT, padH,
    padW)*. Default: 0 "padding='valid'" is the same as no
    padding. "padding='same'" pads the input so the output has the
    same shape as the input. However, this mode doesn't support
    any stride values other than 1.

    Warning:

      For "padding='same'", if the "weight" is even-length and
      "dilation" is odd in any dimension, a full "pad()" operation
      may be needed internally. Lowering performance.


dilation -- the spacing between kernel elements. Can be a
        single number or a tuple (dT, dH, dW). Default: 1

groups -- split input into groups, \text{in_channels}
    should be divisible by the number of groups. Default: 1

Examples:
  >>> filters = torch.randn(33, 16, 3, 3, 3)
  >>> inputs = torch.randn(20, 16, 50, 10, 20)
  >>> F.conv3d(inputs, filters)


torch.Tensor.is_sparse
Tensor.is_sparse
Is "True" if the Tensor uses sparse storage layout, "False"
   otherwise.


ReplicationPad3d
class torch.nn.ReplicationPad3d(padding)
Pads the input tensor using replication of the input boundary.
For N-dimensional padding, use "torch.nn.functional.pad()".
Parameters:
      padding (int, tuple) -- the size of the padding. If is
      int, uses the same padding in all boundaries. If a 6-tuple,
      uses (\text{padding_left}, \text{padding_right},
      \text{padding_top}, \text{padding_bottom},
      \text{padding_front}, \text{padding_back})
Shape:
      * Input: (N, C, D_{in}, H_{in}, W_{in}) or (C, D_{in}, H_{in},
        W_{in}).
  * Output: (N, C, D_{out}, H_{out}, W_{out}) or (C, D_{out},
    H_{out}, W_{out}), where

    D_{out} = D_{in} + \text{padding\_front} +
    \text{padding\_back}

    H_{out} = H_{in} + \text{padding\_top} +
    \text{padding\_bottom}

    W_{out} = W_{in} + \text{padding\_left} +
    \text{padding\_right}

Examples:
  >>> m = nn.ReplicationPad3d(3)


Examples:
  >>> m = nn.ReplicationPad3d(3)
  >>> input = torch.randn(16, 3, 8, 320, 480)
  >>> output = m(input)
  >>> # using different paddings for different sides
  >>> m = nn.ReplicationPad3d((3, 3, 6, 6, 1, 1))
  >>> output = m(input)


torch.nn.functional.gaussian_nll_loss
torch.nn.functional.gaussian_nll_loss(input, target, var, full=False, eps=1e-06, reduction='mean')
Gaussian negative log likelihood loss.
See "GaussianNLLLoss" for details.
Parameters:
      * input (Tensor) -- expectation of the Gaussian
        distribution.
  * **target** (*Tensor*) -- sample from the Gaussian
    distribution.

  * **var** (*Tensor*) -- tensor of positive variance(s), one for
    each of the expectations in the input (heteroscedastic), or a
    single one (homoscedastic).

  * **full** (*bool**, **optional*) -- include the constant term
    in the loss calculation. Default: "False".

  * **eps** (*float**, **optional*) -- value added to var, for
    stability. Default: 1e-6.

  * **reduction** (*str**, **optional*) -- specifies the reduction
    to apply to the output: "'none'" | "'mean'" | "'sum'".


"'none'": no reduction will be applied, "'mean'": the output
        is the average of all batch member losses, "'sum'": the output
        is the sum of all batch member losses. Default: "'mean'".
Return type:
      Tensor


torch.foreach_round
torch.foreach_round(self: List[Tensor]) -> None
Apply "torch.round()" to each Tensor of the input list.


torch.frac
torch.frac(input, *, out=None) -> Tensor
Computes the fractional portion of each element in "input".
  \text{out}_{i} = \text{input}_{i} - \left\lfloor
  |\text{input}_{i}| \right\rfloor *
  \operatorname{sgn}(\text{input}_{i})

Example:
  >>> torch.frac(torch.tensor([1, 2.5, -3.2]))
  tensor([ 0.0000,  0.5000, -0.2000])


adaptive_avg_pool3d
class torch.ao.nn.quantized.functional.adaptive_avg_pool3d(input, output_size)
Applies a 3D adaptive average pooling over a quantized input signal
   composed of several quantized input planes.
Note:
 The input quantization parameters propagate to the output.

See "AdaptiveAvgPool3d" for details and output shape.
Parameters:
      output_size (None) -- the target output size (single
      integer or double-integer tuple)
Return type:
      Tensor


torch.smm
torch.smm(input, mat) -> Tensor
Performs a matrix multiplication of the sparse matrix "input" with
   the dense matrix "mat".
Parameters:
      * input (Tensor) -- a sparse matrix to be matrix
        multiplied
  * **mat** (*Tensor*) -- a dense matrix to be matrix multiplied


torch.Tensor.erf
Tensor.erf() -> Tensor
See "torch.erf()"


torch.fft.rfftfreq
torch.fft.rfftfreq(n, d=1.0, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor
Computes the sample frequencies for "rfft()" with a signal of size
   "n".
Note:
 "rfft()" returns Hermitian one-sided output, so only the positive
 frequency terms are returned. For a real FFT of length "n" and
 with inputs spaced in length unit "d", the frequencies are:

    f = torch.arange((n + 1) // 2) / (d * n)

Note:
 For even lengths, the Nyquist frequency at "f[n/2]" can be
 thought of as either negative or positive. Unlike "fftfreq()",
 "rfftfreq()" always returns it as positive.

Parameters:
      * n (int) -- the real FFT length
  * **d** (*float**, **optional*) -- The sampling length scale.
    The spacing between individual samples of the FFT input. The
    default assumes unit spacing, dividing that result by the


actual spacing gives the result in physical frequency units.
Keyword Arguments:
      * out (Tensor, optional) -- the output tensor.
  * **dtype** ("torch.dtype", optional) -- the desired data type
    of returned tensor. Default: if "None", uses a global default
    (see "torch.set_default_tensor_type()").

  * **layout** ("torch.layout", optional) -- the desired layout of
    returned Tensor. Default: "torch.strided".

  * **device** ("torch.device", optional) -- the desired device of
    returned tensor. Default: if "None", uses the current device
    for the default tensor type (see
    "torch.set_default_tensor_type()"). "device" will be the CPU
    for CPU tensor types and the current CUDA device for CUDA
    tensor types.

  * **requires_grad** (*bool**, **optional*) -- If autograd should
    record operations on the returned tensor. Default: "False".

-[ Example ]-

torch.fft.rfftfreq(5)


-[ Example ]-

torch.fft.rfftfreq(5)
   tensor([0.0000, 0.2000, 0.4000])
torch.fft.rfftfreq(4)
   tensor([0.0000, 0.2500, 0.5000])

Compared to the output from "fftfreq()", we see that the Nyquist
   frequency at "f[2]" has changed sign: >>> torch.fft.fftfreq(4)
   tensor([ 0.0000,  0.2500, -0.5000, -0.2500])


GRU
class torch.nn.GRU(args, *kwargs)
Applies a multi-layer gated recurrent unit (GRU) RNN to an input
   sequence.
For each element in the input sequence, each layer computes the
   following function:
  \begin{array}{ll}     r_t = \sigma(W_{ir} x_t + b_{ir} + W_{hr}
  h_{(t-1)} + b_{hr}) \\     z_t = \sigma(W_{iz} x_t + b_{iz} +
  W_{hz} h_{(t-1)} + b_{hz}) \\     n_t = \tanh(W_{in} x_t +
  b_{in} + r_t * (W_{hn} h_{(t-1)}+ b_{hn})) \\     h_t = (1 -
  z_t) * n_t + z_t * h_{(t-1)} \end{array}

where h_t is the hidden state at time t, x_t is the input at time
   t, h_{(t-1)} is the hidden state of the layer at time t-1 or
   the initial hidden state at time 0, and r_t, z_t, n_t are the
   reset, update, and new gates, respectively. \sigma is the sigmoid
   function, and * is the Hadamard product.
In a multilayer GRU, the input x^{(l)}_t of the l -th layer (l >=
   2) is the hidden state h^{(l-1)}_t of the previous layer multiplied


by dropout \delta^{(l-1)}_t where each \delta^{(l-1)}_t is a
   Bernoulli random variable which is 0 with probability "dropout".
Parameters:
      * input_size -- The number of expected features in the input
        x
  * **hidden_size** -- The number of features in the hidden state
    *h*

  * **num_layers** -- Number of recurrent layers. E.g., setting
    "num_layers=2" would mean stacking two GRUs together to form a
    *stacked GRU*, with the second GRU taking in outputs of the
    first GRU and computing the final results. Default: 1

  * **bias** -- If "False", then the layer does not use bias
    weights *b_ih* and *b_hh*. Default: "True"

  * **batch_first** -- If "True", then the input and output
    tensors are provided as *(batch, seq, feature)* instead of
    *(seq, batch, feature)*. Note that this does not apply to
    hidden or cell states. See the Inputs/Outputs sections below
    for details.  Default: "False"


for details.  Default: "False"
  * **dropout** -- If non-zero, introduces a *Dropout* layer on
    the outputs of each GRU layer except the last layer, with
    dropout probability equal to "dropout". Default: 0

  * **bidirectional** -- If "True", becomes a bidirectional GRU.
    Default: "False"

Inputs: input, h_0
      * input: tensor of shape (L, H_{in}) for unbatched input,
        (L, N, H_{in}) when "batch_first=False" or (N, L, H_{in}) when
        "batch_first=True" containing the features of the input
        sequence.  The input can also be a packed variable length
        sequence. See "torch.nn.utils.rnn.pack_padded_sequence()" or
        "torch.nn.utils.rnn.pack_sequence()" for details.
  * **h_0**: tensor of shape (D * \text{num\_layers}, H_{out}) or
    (D * \text{num\_layers}, N, H_{out}) containing the initial
    hidden state for the input sequence. Defaults to zeros if not
    provided.

  where:


provided.
  where:

     \begin{aligned}     N ={} & \text{batch size} \\     L ={} &
     \text{sequence length} \\     D ={} & 2 \text{ if
     bidirectional=True otherwise } 1 \\     H_{in} ={} &
     \text{input\_size} \\     H_{out} ={} & \text{hidden\_size}
     \end{aligned}

Outputs: output, h_n
      * output: tensor of shape (L, D * H_{out}) for unbatched
        input, (L, N, D * H_{out}) when "batch_first=False" or (N, L,
        D * H_{out}) when "batch_first=True" containing the output
        features (h_t) from the last layer of the GRU, for each t.
        If a "torch.nn.utils.rnn.PackedSequence" has been given as the
        input, the output will also be a packed sequence.
  * **h_n**: tensor of shape (D * \text{num\_layers}, H_{out}) or
    (D * \text{num\_layers}, N, H_{out}) containing the final
    hidden state for the input sequence.

Variables:
      * weight_ih_l[k] -- the learnable input-hidden weights of


the \text{k}^{th} layer (W_ir|W_iz|W_in), of shape
        (3hidden_size, input_size) for k = 0. Otherwise, the
        shape is (3hidden_size, num_directions * hidden_size)
  * **weight_hh_l[k]** -- the learnable hidden-hidden weights of
    the \text{k}^{th} layer (W_hr|W_hz|W_hn), of shape
    *(3*hidden_size, hidden_size)*

  * **bias_ih_l[k]** -- the learnable input-hidden bias of the
    \text{k}^{th} layer (b_ir|b_iz|b_in), of shape
    *(3*hidden_size)*

  * **bias_hh_l[k]** -- the learnable hidden-hidden bias of the
    \text{k}^{th} layer (b_hr|b_hz|b_hn), of shape
    *(3*hidden_size)*

Note:
 All the weights and biases are initialized from
 \mathcal{U}(-\sqrt{k}, \sqrt{k}) where k =
 \frac{1}{\text{hidden\_size}}

Note:
 For bidirectional GRUs, forward and backward are directions 0 and
 1 respectively. Example of splitting the output layers when
 "batch_first=False": "output.view(seq_len, batch, num_directions,


hidden_size)".
Note:
 "batch_first" argument is ignored for unbatched inputs.

Note:
 If the following conditions are satisfied: 1) cudnn is enabled,
 2) input data is on the GPU 3) input data has dtype
 "torch.float16" 4) V100 GPU is used, 5) input data is not in
 "PackedSequence" format persistent algorithm can be selected to
 improve performance.

Examples:
  >>> rnn = nn.GRU(10, 20, 2)
  >>> input = torch.randn(5, 3, 10)
  >>> h0 = torch.randn(2, 3, 20)
  >>> output, hn = rnn(input, h0)


SequentialLR
class torch.optim.lr_scheduler.SequentialLR(optimizer, schedulers, milestones, last_epoch=- 1, verbose=False)
Receives the list of schedulers that is expected to be called
   sequentially during optimization process and milestone points that
   provides exact intervals to reflect which scheduler is supposed to
   be called at a given epoch.
Parameters:
      * optimizer (Optimizer) -- Wrapped optimizer.
  * **schedulers** (*list*) -- List of chained schedulers.

  * **milestones** (*list*) -- List of integers that reflects
    milestone points.

  * **last_epoch** (*int*) -- The index of last epoch. Default:
    -1.

  * **verbose** (*bool*) -- Does nothing.

-[ Example ]-

Assuming optimizer uses lr = 1. for all groups
lr = 0.1     if epoch == 0
lr = 0.1     if epoch == 1
lr = 0.9     if epoch == 2
lr = 0.81    if epoch == 3
lr = 0.729   if epoch == 4


lr = 0.729   if epoch == 4
scheduler1 = ConstantLR(self.opt, factor=0.1, total_iters=2)
scheduler2 = ExponentialLR(self.opt, gamma=0.9)
scheduler = SequentialLR(self.opt, schedulers=[scheduler1, scheduler2], milestones=[2])
for epoch in range(100):
    train(...)
    validate(...)
    scheduler.step()

get_last_lr()
  Return last computed learning rate by current scheduler.

load_state_dict(state_dict)
  Loads the schedulers state.

  Parameters:
     **state_dict** (*dict*) -- scheduler state. Should be an
     object returned from a call to "state_dict()".

print_lr(is_verbose, group, lr, epoch=None)
  Display the current learning rate.

state_dict()
  Returns the state of the scheduler as a "dict".

  It contains an entry for every variable in self.__dict__ which
  is not the optimizer. The wrapped scheduler states will also be
  saved.


torch.Tensor.argwhere
Tensor.argwhere() -> Tensor
See "torch.argwhere()"


torch.Tensor.addcdiv
Tensor.addcdiv(tensor1, tensor2, *, value=1) -> Tensor
See "torch.addcdiv()"


torch.floor_divide
torch.floor_divide(input, other, *, out=None) -> Tensor
Note:
 Before PyTorch 1.13 "torch.floor_divide()" incorrectly performed
 truncation division. To restore the previous behavior use
 "torch.div()" with "rounding_mode='trunc'".

Computes "input" divided by "other", elementwise, and floors the
   result.
  \text{{out}}_i = \text{floor} \left(
  \frac{{\text{{input}}_i}}{{\text{{other}}_i}} \right)

Supports broadcasting to a common shape, type promotion, and
   integer and float inputs.
Parameters:
      * input (Tensor or Number) -- the dividend
  * **other** (*Tensor** or **Number*) -- the divisor

Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Example:
  >>> a = torch.tensor([4.0, 3.0])
  >>> b = torch.tensor([2.0, 2.0])
  >>> torch.floor_divide(a, b)
  tensor([2.0, 1.0])
  >>> torch.floor_divide(a, 1.4)
  tensor([2.0, 2.0])


torch.get_float32_matmul_precision
torch.get_float32_matmul_precision()
Returns the current value of float32 matrix multiplication
   precision. Refer to "torch.set_float32_matmul_precision()"
   documentation for more details.
Return type:
      str


prepare_qat_fx
class torch.quantization.quantize_fx.prepare_qat_fx(model, qconfig_mapping, example_inputs, prepare_custom_config=None, backend_config=None)
Prepare a model for quantization aware training
Parameters:
      * model (***) -- torch.nn.Module model
  * **qconfig_mapping** (***) -- see "prepare_fx()"

  * **example_inputs** (***) -- see "prepare_fx()"

  * **prepare_custom_config** (***) -- see "prepare_fx()"

  * **backend_config** (***) -- see "prepare_fx()"

Returns:
      A GraphModule with fake quant modules (configured by
      qconfig_mapping and backend_config), ready for quantization
      aware training
Return type:
      ObservedGraphModule
Example:
  import torch
  from torch.ao.quantization import get_default_qat_qconfig_mapping
  from torch.ao.quantization import prepare_fx

  class Submodule(torch.nn.Module):
      def __init__(self):
          super().__init__()


super().init()
              self.linear = torch.nn.Linear(5, 5)
          def forward(self, x):
              x = self.linear(x)
              return x
  class M(torch.nn.Module):
      def __init__(self):
          super().__init__()
          self.linear = torch.nn.Linear(5, 5)
          self.sub = Submodule()

      def forward(self, x):
          x = self.linear(x)
          x = self.sub(x) + x
          return x

  # initialize a floating point model
  float_model = M().train()
  # (optional, but preferred) load the weights from pretrained model
  # float_model.load_weights(...)

  # define the training loop for quantization aware training
  def train_loop(model, train_data):
      model.train()
      for image, target in data_loader:
          ...

  # qconfig is the configuration for how we insert observers for a particular
  # operator
  # qconfig = get_default_qconfig("fbgemm")


qconfig = get_default_qconfig("fbgemm")
  # Example of customizing qconfig:
  # qconfig = torch.ao.quantization.QConfig(
  #    activation=FakeQuantize.with_args(observer=MinMaxObserver.with_args(dtype=torch.qint8)),
  #    weight=FakeQuantize.with_args(observer=MinMaxObserver.with_args(dtype=torch.qint8)))
  # `activation` and `weight` are constructors of observer module

  # qconfig_mapping is a collection of quantization configurations, user can
  # set the qconfig for each operator (torch op calls, functional calls, module calls)
  # in the model through qconfig_mapping
  # the following call will get the qconfig_mapping that works best for models
  # that target "fbgemm" backend
  qconfig_mapping = get_default_qat_qconfig("fbgemm")

  # We can customize qconfig_mapping in different ways, please take a look at
  # the docstring for :func:`~torch.ao.quantization.prepare_fx` for different ways
  # to configure this


to configure this
  # example_inputs is a tuple of inputs, that is used to infer the type of the
  # outputs in the model
  # currently it's not used, but please make sure model(*example_inputs) runs
  example_inputs = (torch.randn(1, 3, 224, 224),)

  # TODO: add backend_config after we split the backend_config for fbgemm and qnnpack
  # e.g. backend_config = get_default_backend_config("fbgemm")
  # `prepare_qat_fx` inserts observers in the model based on qconfig_mapping and
  # backend_config, if the configuration for an operator in qconfig_mapping
  # is supported in the backend_config (meaning it's supported by the target
  # hardware), we'll insert fake_quantize modules according to the qconfig_mapping
  # otherwise the configuration in qconfig_mapping will be ignored
  # see :func:`~torch.ao.quantization.prepare_fx` for a detailed explanation of
  # how qconfig_mapping interacts with backend_config


prepared_model = prepare_qat_fx(float_model, qconfig_mapping, example_inputs)
      # Run training
      train_loop(prepared_model, train_loop)


torch.Tensor.std
Tensor.std(dim=None, *, correction=1, keepdim=False) -> Tensor
See "torch.std()"


BNReLU3d
class torch.ao.nn.intrinsic.quantized.BNReLU3d(num_features, eps=1e-05, momentum=0.1, device=None, dtype=None)
A BNReLU3d module is a fused module of BatchNorm3d and ReLU
We adopt the same interface as "torch.ao.nn.quantized.BatchNorm3d".
Variables:
      torch.ao.nn.quantized.BatchNorm3d (Same as) --


torch.Tensor.sign_
Tensor.sign_() -> Tensor
In-place version of "sign()"


torch.Tensor.floor
Tensor.floor() -> Tensor
See "torch.floor()"


torch.normal
torch.normal(mean, std, *, generator=None, out=None) -> Tensor
Returns a tensor of random numbers drawn from separate normal
   distributions whose mean and standard deviation are given.
The "mean" is a tensor with the mean of each output element's
   normal distribution
The "std" is a tensor with the standard deviation of each output
   element's normal distribution
The shapes of "mean" and "std" don't need to match, but the total
   number of elements in each tensor need to be the same.
Note:
 When the shapes do not match, the shape of "mean" is used as the
 shape for the returned output tensor

Note:
 When "std" is a CUDA tensor, this function synchronizes its
 device with the CPU.

Parameters:
      * mean (Tensor) -- the tensor of per-element means
  * **std** (*Tensor*) -- the tensor of per-element standard
    deviations

Keyword Arguments:
      * generator ("torch.Generator", optional) -- a pseudorandom


number generator for sampling
  * **out** (*Tensor**, **optional*) -- the output tensor.

Example:
  >>> torch.normal(mean=torch.arange(1., 11.), std=torch.arange(1, 0, -0.1))
  tensor([  1.0425,   3.5672,   2.7969,   4.2925,   4.7229,   6.2134,
            8.0505,   8.1408,   9.0563,  10.0566])

torch.normal(mean=0.0, std, *, out=None) -> Tensor
Similar to the function above, but the means are shared among all
   drawn elements.
Parameters:
      * mean (float, optional) -- the mean for all
        distributions
  * **std** (*Tensor*) -- the tensor of per-element standard
    deviations

Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Example:
  >>> torch.normal(mean=0.5, std=torch.arange(1., 6.))
  tensor([-1.2793, -1.0732, -2.0687,  5.1177, -1.2303])

torch.normal(mean, std=1.0, *, out=None) -> Tensor
Similar to the function above, but the standard deviations are


shared among all drawn elements.
Parameters:
      * mean (Tensor) -- the tensor of per-element means
  * **std** (*float**, **optional*) -- the standard deviation for
    all distributions

Keyword Arguments:
      out (Tensor, optional) -- the output tensor
Example:
  >>> torch.normal(mean=torch.arange(1., 6.))
  tensor([ 1.1552,  2.6148,  2.6535,  5.8318,  4.2361])

torch.normal(mean, std, size, *, out=None) -> Tensor
Similar to the function above, but the means and standard
   deviations are shared among all drawn elements. The resulting
   tensor has size given by "size".
Parameters:
      * mean (float) -- the mean for all distributions
  * **std** (*float*) -- the standard deviation for all
    distributions

  * **size** (*int**...*) -- a sequence of integers defining the
    shape of the output tensor.

Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Example:


Example:
  >>> torch.normal(2, 3, size=(1, 4))
  tensor([[-1.3987, -1.9544,  3.6048,  0.7909]])


RNNCell
class torch.ao.nn.quantized.dynamic.RNNCell(input_size, hidden_size, bias=True, nonlinearity='tanh', dtype=torch.qint8)
An Elman RNN cell with tanh or ReLU non-linearity. A dynamic
   quantized RNNCell module with floating point tensor as inputs and
   outputs. Weights are quantized to 8 bits. We adopt the same
   interface as torch.nn.RNNCell, please see
   https://pytorch.org/docs/stable/nn.html#torch.nn.RNNCell for
   documentation.
Examples:
  >>> rnn = nn.RNNCell(10, 20)
  >>> input = torch.randn(6, 3, 10)
  >>> hx = torch.randn(3, 20)
  >>> output = []
  >>> for i in range(6):
  ...     hx = rnn(input[i], hx)
  ...     output.append(hx)


torch.Tensor.cpu
Tensor.cpu(memory_format=torch.preserve_format) -> Tensor
Returns a copy of this object in CPU memory.
If this object is already in CPU memory and on the correct device,
   then no copy is performed and the original object is returned.
Parameters:
      memory_format ("torch.memory_format", optional) -- the
      desired memory format of returned Tensor. Default:
      "torch.preserve_format".


torch.select
torch.select(input, dim, index) -> Tensor
Slices the "input" tensor along the selected dimension at the given
   index. This function returns a view of the original tensor with the
   given dimension removed.
Note:
 If "input" is a sparse tensor and returning a view of the tensor
 is not possible, a RuntimeError exception is raised. In this is
 the case, consider using "torch.select_copy()" function.

Parameters:
      * input (Tensor) -- the input tensor.
  * **dim** (*int*) -- the dimension to slice

  * **index** (*int*) -- the index to select with

Note:
 "select()" is equivalent to slicing. For example,
 "tensor.select(0, index)" is equivalent to "tensor[index]" and
 "tensor.select(2, index)" is equivalent to "tensor[:,:,index]".


torch.cuda.current_blas_handle
torch.cuda.current_blas_handle()
Returns cublasHandle_t pointer to current cuBLAS handle


torch.Tensor.int
Tensor.int(memory_format=torch.preserve_format) -> Tensor
"self.int()" is equivalent to "self.to(torch.int32)". See "to()".
Parameters:
      memory_format ("torch.memory_format", optional) -- the
      desired memory format of returned Tensor. Default:
      "torch.preserve_format".


torch.Tensor.erfc
Tensor.erfc() -> Tensor
See "torch.erfc()"


torch.Tensor.abs
Tensor.abs() -> Tensor
See "torch.abs()"


torch.Tensor.scatter
Tensor.scatter(dim, index, src) -> Tensor
Out-of-place version of "torch.Tensor.scatter_()"


torch.nn.functional.soft_margin_loss
torch.nn.functional.soft_margin_loss(input, target, size_average=None, reduce=None, reduction='mean') -> Tensor
See "SoftMarginLoss" for details.
Return type:
      Tensor


torch.from_dlpack
torch.from_dlpack(ext_tensor) -> Tensor
Converts a tensor from an external library into a "torch.Tensor".
The returned PyTorch tensor will share the memory with the input
   tensor (which may have come from another library). Note that in-
   place operations will therefore also affect the data of the input
   tensor. This may lead to unexpected issues (e.g., other libraries
   may have read-only flags or immutable data structures), so the user
   should only do this if they know for sure that this is fine.
Parameters:
      ext_tensor (object with "dlpack" attribute, or a DLPack
      capsule) --
  The tensor or DLPack capsule to convert.

  If "ext_tensor" is a tensor (or ndarray) object, it must support
  the "__dlpack__" protocol (i.e., have a "ext_tensor.__dlpack__"
  method). Otherwise "ext_tensor" may be a DLPack capsule, which
  is an opaque "PyCapsule" instance, typically produced by a
  "to_dlpack" function or method.


"to_dlpack" function or method.
Return type:
      Tensor
Examples:
  >>> import torch.utils.dlpack
  >>> t = torch.arange(4)

  # Convert a tensor directly (supported in PyTorch >= 1.10)
  >>> t2 = torch.from_dlpack(t)
  >>> t2[:2] = -1  # show that memory is shared
  >>> t2
  tensor([-1, -1,  2,  3])
  >>> t
  tensor([-1, -1,  2,  3])

  # The old-style DLPack usage, with an intermediate capsule object
  >>> capsule = torch.utils.dlpack.to_dlpack(t)
  >>> capsule
  <capsule object "dltensor" at ...>
  >>> t3 = torch.from_dlpack(capsule)
  >>> t3
  tensor([-1, -1,  2,  3])
  >>> t3[0] = -9  # now we're sharing memory between 3 tensors
  >>> t3
  tensor([-9, -1,  2,  3])
  >>> t2
  tensor([-9, -1,  2,  3])
  >>> t
  tensor([-9, -1,  2,  3])


torch.Tensor.is_set_to
Tensor.is_set_to(tensor) -> bool
Returns True if both tensors are pointing to the exact same memory
   (same storage, offset, size and stride).


DTypeWithConstraints
class torch.ao.quantization.backend_config.DTypeWithConstraints(dtype=None, quant_min_lower_bound=None, quant_max_upper_bound=None, scale_min_lower_bound=None, scale_max_upper_bound=None, scale_exact_match=None, zero_point_exact_match=None)
Config for specifying additional constraints for a given dtype,
   such as quantization value ranges, scale value ranges, and fixed
   quantization params, to be used in "DTypeConfig".
The constraints currently supported are:

quant_min_lower_bound and quant_max_upper_bound: Lower and
     upper bounds for the minimum and maximum quantized values
     respectively. If the QConfigâs quant_min and quant_max fall
     outside this range, then the QConfig will be ignored.

scale_min_lower_bound and scale_max_upper_bound: Lower and
     upper bounds for the minimum and maximum scale values
     respectively. If the QConfigâs minimum scale value (currently


exposed as eps) falls below the lower bound, then the QConfig
     will be ignored. Note that the upper bound is currently not
     enforced.

scale_exact_match and zero_point_exact_match: Exact match
     requirements for scale and zero point, to be used for operators
     with fixed quantization parameters such as sigmoid and tanh. If
     the observer specified in the QConfig is neither
     FixedQParamsObserver nor FixedQParamsFakeQuantize, or if the
     quantization parameters don't match, then the QConfig will be
     ignored.


Hardtanh
class torch.nn.Hardtanh(min_val=- 1.0, max_val=1.0, inplace=False, min_value=None, max_value=None)
Applies the HardTanh function element-wise.
HardTanh is defined as:
  \text{HardTanh}(x) = \begin{cases}     \text{max\_val} & \text{
  if } x > \text{ max\_val } \\     \text{min\_val} & \text{ if }
  x < \text{ min\_val } \\     x & \text{ otherwise } \\
  \end{cases}

Parameters:
      * min_val (float) -- minimum value of the linear region
        range. Default: -1
  * **max_val** (*float*) -- maximum value of the linear region
    range. Default: 1

  * **inplace** (*bool*) -- can optionally do the operation in-
    place. Default: "False"

Keyword arguments "min_value" and "max_value" have been deprecated
   in favor of "min_val" and "max_val".
Shape:
      * Input: (*), where * means any number of dimensions.
  * Output: (*), same shape as the input.

[image]
Examples:
  >>> m = nn.Hardtanh(-2, 2)


Examples:
  >>> m = nn.Hardtanh(-2, 2)
  >>> input = torch.randn(2)
  >>> output = m(input)


ConvBn2d
class torch.ao.nn.intrinsic.qat.ConvBn2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=None, padding_mode='zeros', eps=1e-05, momentum=0.1, freeze_bn=False, qconfig=None)
A ConvBn2d module is a module fused from Conv2d and BatchNorm2d,
   attached with FakeQuantize modules for weight, used in quantization
   aware training.
We combined the interface of "torch.nn.Conv2d" and
   "torch.nn.BatchNorm2d".
Similar to "torch.nn.Conv2d", with FakeQuantize modules initialized
   to default.
Variables:
      * freeze_bn --
  * **weight_fake_quant** -- fake quant module for weight


torch.where
torch.where(condition, input, other, *, out=None) -> Tensor
Return a tensor of elements selected from either "input" or
   "other", depending on "condition".
The operation is defined as:
  \text{out}_i = \begin{cases}     \text{input}_i & \text{if }
  \text{condition}_i \\     \text{other}_i & \text{otherwise} \\
  \end{cases}

Note:
 The tensors "condition", "input", "other" must be broadcastable.

Parameters:
      * condition (BoolTensor) -- When True (nonzero), yield
        input, otherwise yield other
  * **input** (*Tensor** or **Scalar*) -- value (if "input" is a
    scalar) or values selected at indices where "condition" is
    "True"

  * **other** (*Tensor** or **Scalar*) -- value (if "other" is a
    scalar) or values selected at indices where "condition" is
    "False"

Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Returns:


Returns:
      A tensor of shape equal to the broadcasted shape of "condition",
      "input", "other"
Return type:
      Tensor
Example:
  >>> x = torch.randn(3, 2)
  >>> y = torch.ones(3, 2)
  >>> x
  tensor([[-0.4620,  0.3139],
          [ 0.3898, -0.7197],
          [ 0.0478, -0.1657]])
  >>> torch.where(x > 0, x, y)
  tensor([[ 1.0000,  0.3139],
          [ 0.3898,  1.0000],
          [ 0.0478,  1.0000]])
  >>> x = torch.randn(2, 2, dtype=torch.double)
  >>> x
  tensor([[ 1.0779,  0.0383],
          [-0.8785, -1.1089]], dtype=torch.float64)
  >>> torch.where(x > 0, x, 0.)
  tensor([[1.0779, 0.0383],
          [0.0000, 0.0000]], dtype=torch.float64)

torch.where(condition) -> tuple of LongTensor
"torch.where(condition)" is identical to "torch.nonzero(condition,
   as_tuple=True)".
Note:
 See also "torch.nonzero()".


torch.Tensor.clamp_
Tensor.clamp_(min=None, max=None) -> Tensor
In-place version of "clamp()"


torch.Tensor.le
Tensor.le(other) -> Tensor
See "torch.le()".


GRUCell
class torch.ao.nn.quantized.dynamic.GRUCell(input_size, hidden_size, bias=True, dtype=torch.qint8)
A gated recurrent unit (GRU) cell
A dynamic quantized GRUCell module with floating point tensor as
   inputs and outputs. Weights are quantized to 8 bits. We adopt the
   same interface as torch.nn.GRUCell, please see
   https://pytorch.org/docs/stable/nn.html#torch.nn.GRUCell for
   documentation.
Examples:
  >>> rnn = nn.GRUCell(10, 20)
  >>> input = torch.randn(6, 3, 10)
  >>> hx = torch.randn(3, 20)
  >>> output = []
  >>> for i in range(6):
  ...     hx = rnn(input[i], hx)
  ...     output.append(hx)


torch.Tensor.narrow
Tensor.narrow(dimension, start, length) -> Tensor
See "torch.narrow()".


PerChannelMinMaxObserver
class torch.quantization.observer.PerChannelMinMaxObserver(ch_axis=0, dtype=torch.quint8, qscheme=torch.per_channel_affine, reduce_range=False, quant_min=None, quant_max=None, factory_kwargs=None, eps=1.1920928955078125e-07)
Observer module for computing the quantization parameters based on
   the running per channel min and max values.
This observer uses the tensor min/max statistics to compute the per
   channel quantization parameters. The module records the running
   minimum and maximum of incoming tensors, and uses this statistic to
   compute the quantization parameters.
Parameters:
      * ch_axis -- Channel axis
  * **dtype** -- dtype argument to the *quantize* node needed to
    implement the reference model spec.

  * **qscheme** -- Quantization scheme to be used

  * **reduce_range** -- Reduces the range of the quantized data
    type by 1 bit


type by 1 bit
  * **quant_min** -- Minimum quantization value. If unspecified,
    it will follow the 8-bit setup.

  * **quant_max** -- Maximum quantization value. If unspecified,
    it will follow the 8-bit setup.

  * **eps** (*Tensor*) -- Epsilon value for float32, Defaults to
    *torch.finfo(torch.float32).eps*.

The quantization parameters are computed the same way as in
   "MinMaxObserver", with the difference that the running min/max
   values are stored per channel. Scales and zero points are thus
   computed per channel as well.
Note:
 If the running minimum equals to the running maximum, the scales
 and zero_points are set to 1.0 and 0.

reset_min_max_vals()
  Resets the min/max values.


torch.blackman_window
torch.blackman_window(window_length, periodic=True, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor
Blackman window function.
  w[n] = 0.42 - 0.5 \cos \left( \frac{2 \pi n}{N - 1} \right) +
  0.08 \cos \left( \frac{4 \pi n}{N - 1} \right)

where N is the full window size.
The input "window_length" is a positive integer controlling the
   returned window size. "periodic" flag determines whether the
   returned window trims off the last duplicate value from the
   symmetric window and is ready to be used as a periodic window with
   functions like "torch.stft()". Therefore, if "periodic" is true,
   the N in above formula is in fact \text{window_length} + 1. Also,
   we always have "torch.blackman_window(L, periodic=True)" equal to
   "torch.blackman_window(L + 1, periodic=False)[:-1])".
Note:
 If "window_length" =1, the returned window contains a single
 value 1.

Parameters:


value 1.
Parameters:
      * window_length (int) -- the size of returned window
  * **periodic** (*bool**, **optional*) -- If True, returns a
    window to be used as periodic function. If False, return a
    symmetric window.

Keyword Arguments:
      * dtype ("torch.dtype", optional) -- the desired data type
        of returned tensor. Default: if "None", uses a global default
        (see "torch.set_default_tensor_type()"). Only floating point
        types are supported.
  * **layout** ("torch.layout", optional) -- the desired layout of
    returned window tensor. Only "torch.strided" (dense layout) is
    supported.

  * **device** ("torch.device", optional) -- the desired device of
    returned tensor. Default: if "None", uses the current device
    for the default tensor type (see
    "torch.set_default_tensor_type()"). "device" will be the CPU
    for CPU tensor types and the current CUDA device for CUDA
    tensor types.


tensor types.
  * **requires_grad** (*bool**, **optional*) -- If autograd should
    record operations on the returned tensor. Default: "False".

Returns:
      A 1-D tensor of size (\text{window_length},) containing the
      window
Return type:
      Tensor


torch.Tensor.svd
Tensor.svd(some=True, compute_uv=True)
See "torch.svd()"


torch.cuda.stream
torch.cuda.stream(stream)
Wrapper around the Context-manager StreamContext that selects a
   given stream.
Parameters:
      stream (Stream) -- selected stream. This manager is a no-
      op if it's "None".
Return type:
      StreamContext
..Note:: In eager mode stream is of type Stream class while in JIT
   it is an object of the custom class "torch.classes.cuda.Stream".


torch.Tensor.log_
Tensor.log_() -> Tensor
In-place version of "log()"


device_of
class torch.cuda.device_of(obj)
Context-manager that changes the current device to that of given
   object.
You can use both tensors and storages as arguments. If a given
   object is not allocated on a GPU, this is a no-op.
Parameters:
      obj (Tensor or Storage) -- object allocated on the
      selected device.


torch.histogram
torch.histogram(input, bins, *, range=None, weight=None, density=False, out=None)
Computes a histogram of the values in a tensor.
"bins" can be an integer or a 1D tensor.
If "bins" is an int, it specifies the number of equal-width bins.
   By default, the lower and upper range of the bins is determined by
   the minimum and maximum elements of the input tensor. The "range"
   argument can be provided to specify a range for the bins.
If "bins" is a 1D tensor, it specifies the sequence of bin edges
   including the rightmost edge. It should contain at least 2 elements
   and its elements should be increasing.
Parameters:
      * input (Tensor) -- the input tensor.
  * **bins** -- int or 1D Tensor. If int, defines the number of
    equal-width bins. If tensor, defines the sequence of bin edges
    including the rightmost edge.

Keyword Arguments:
      * range (tuple of python:float) -- Defines the range of
        the bins.


the bins.
  * **weight** (*Tensor*) -- If provided, weight should have the
    same shape as input. Each value in input contributes its
    associated weight towards its bin's result.

  * **density** (*bool*) -- If False, the result will contain the
    count (or total weight) in each bin. If True, the result is
    the value of the probability density function over the bins,
    normalized such that the integral over the range of the bins
    is 1.

  * **out** (*Tensor**, **optional*) -- the output tensor. (tuple,
    optional): The result tuple of two output tensors (hist,
    bin_edges).

Returns:
      1D Tensor containing the values of the histogram.
      bin_edges(Tensor): 1D Tensor containing the edges of the
      histogram bins.
Return type:
      hist (Tensor)
Example:
  >>> torch.histogram(torch.tensor([1., 2, 1]), bins=4, range=(0., 3.), weight=torch.tensor([1., 2., 4.]))


(tensor([ 0.,  5.,  2.,  0.]), tensor([0., 0.75, 1.5, 2.25, 3.]))
      >>> torch.histogram(torch.tensor([1., 2, 1]), bins=4, range=(0., 3.), weight=torch.tensor([1., 2., 4.]), density=True)
      (tensor([ 0.,  0.9524,  0.3810,  0.]), tensor([0., 0.75, 1.5, 2.25, 3.]))


torch.Tensor.arctan
Tensor.arctan() -> Tensor
See "torch.arctan()"


torch.polygamma
torch.polygamma(n, input, *, out=None) -> Tensor
Alias for "torch.special.polygamma()".


torch.cuda.comm.broadcast_coalesced
torch.cuda.comm.broadcast_coalesced(tensors, devices, buffer_size=10485760)
Broadcasts a sequence tensors to the specified GPUs. Small tensors
   are first coalesced into a buffer to reduce the number of
   synchronizations.
Parameters:
      * tensors (sequence) -- tensors to broadcast. Must be on
        the same device, either CPU or GPU.
  * **devices** (*Iterable**[**torch.device**, **str** or
    **int**]*) -- an iterable of GPU devices, among which to
    broadcast.

  * **buffer_size** (*int*) -- maximum size of the buffer used for
    coalescing

Returns:
      A tuple containing copies of "tensor", placed on "devices".


torch._foreach_abs
torch._foreach_abs(self: List[Tensor]) -> List[Tensor]
Apply "torch.abs()" to each Tensor of the input list.


torch.neg
torch.neg(input, *, out=None) -> Tensor
Returns a new tensor with the negative of the elements of "input".
  \text{out} = -1 \times \text{input}

Parameters:
      input (Tensor) -- the input tensor.
Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Example:
  >>> a = torch.randn(5)
  >>> a
  tensor([ 0.0090, -0.2262, -0.0682, -0.2866,  0.3940])
  >>> torch.neg(a)
  tensor([-0.0090,  0.2262,  0.0682,  0.2866, -0.3940])


torch.Tensor.floor_
Tensor.floor_() -> Tensor
In-place version of "floor()"


torch.Tensor.heaviside
Tensor.heaviside(values) -> Tensor
See "torch.heaviside()"


torch.nn.functional.max_unpool2d
torch.nn.functional.max_unpool2d(input, indices, kernel_size, stride=None, padding=0, output_size=None)
Computes a partial inverse of "MaxPool2d".
See "MaxUnpool2d" for details.
Return type:
      Tensor


torch.Tensor.scatter_add_
Tensor.scatter_add_(dim, index, src) -> Tensor
Adds all values from the tensor "src" into "self" at the indices
   specified in the "index" tensor in a similar fashion as
   "scatter_()". For each value in "src", it is added to an index in
   "self" which is specified by its index in "src" for "dimension !=
   dim" and by the corresponding value in "index" for "dimension =
   dim".
For a 3-D tensor, "self" is updated as:
  self[index[i][j][k]][j][k] += src[i][j][k]  # if dim == 0
  self[i][index[i][j][k]][k] += src[i][j][k]  # if dim == 1
  self[i][j][index[i][j][k]] += src[i][j][k]  # if dim == 2

"self", "index" and "src" should have same number of dimensions. It
   is also required that "index.size(d) <= src.size(d)" for all
   dimensions "d", and that "index.size(d) <= self.size(d)" for all
   dimensions "d != dim". Note that "index" and "src" do not
   broadcast.
Note:


broadcast.
Note:
 This operation may behave nondeterministically when given tensors
 on a CUDA device. See Reproducibility for more information.

Note:
 The backward pass is implemented only for "src.shape ==
 index.shape".

Parameters:
      * dim (int) -- the axis along which to index
  * **index** (*LongTensor*) -- the indices of elements to scatter
    and add, can be either empty or of the same dimensionality as
    "src". When empty, the operation returns "self" unchanged.

  * **src** (*Tensor*) -- the source elements to scatter and add

Example:
  >>> src = torch.ones((2, 5))
  >>> index = torch.tensor([[0, 1, 2, 0, 0]])
  >>> torch.zeros(3, 5, dtype=src.dtype).scatter_add_(0, index, src)
  tensor([[1., 0., 0., 1., 1.],
          [0., 1., 0., 0., 0.],
          [0., 0., 1., 0., 0.]])
  >>> index = torch.tensor([[0, 1, 2, 0, 0], [0, 1, 2, 2, 2]])
  >>> torch.zeros(3, 5, dtype=src.dtype).scatter_add_(0, index, src)


tensor([[2., 0., 0., 1., 1.],
              [0., 2., 0., 0., 0.],
              [0., 0., 2., 1., 1.]])


torch.jit.optimize_for_inference
torch.jit.optimize_for_inference(mod, other_methods=None)
Performs a set of optimization passes to optimize a model for the
   purposes of inference. If the model is not already frozen,
   optimize_for_inference will invoke torch.jit.freeze
   automatically.
In addition to generic optimizations that should speed up your
   model regardless of environment, prepare for inference will also
   bake in build specific settings such as the presence of CUDNN or
   MKLDNN, and may in the future make transformations which speed
   things up on one machine but slow things down on another.
   Accordingly, serialization is not implemented following invoking
   optimize_for_inference and is not guaranteed.
This is still in prototype, and may have the potential to slow down
   your model. Primary use cases that have been targeted so far have
   been vision models on cpu and gpu to a lesser extent.


Example (optimizing a module with Conv->Batchnorm):
  import torch
  in_channels, out_channels = 3, 32
  conv = torch.nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=2, bias=True)
  bn = torch.nn.BatchNorm2d(out_channels, eps=.001)
  mod = torch.nn.Sequential(conv, bn)
  frozen_mod = torch.jit.optimize_for_inference(torch.jit.script(mod.eval()))
  assert "batch_norm" not in str(frozen_mod.graph)
  # if built with MKLDNN, convolution will be run with MKLDNN weights
  assert "MKLDNN" in frozen_mod.graph

Return type:
      ScriptModule


torch.Tensor.addcmul
Tensor.addcmul(tensor1, tensor2, *, value=1) -> Tensor
See "torch.addcmul()"