shrinath-suresh/blogs-docs-splitted huggingface dataset:
ratio of the input size, this option can be given. This has to
        be a number or tuple in the range (0, 1)
  * **return_indices** -- if "True", will return the indices along
    with the outputs. Useful to pass to "max_unpool3d()".

Shape:
      * Input: (N, C, T_{in}, H_{in}, W_{in}) or (C, T_{in}, H_{in},
        W_{in}).
  * Output: (N, C, T_{out}, H_{out}, W_{out}) or (C, T_{out},
    H_{out}, W_{out}), where (T_{out}, H_{out},
    W_{out})=\text{output\_size} or (T_{out}, H_{out},
    W_{out})=\text{output\_ratio} \times (T_{in}, H_{in}, W_{in})

Examples::
      >>> input = torch.randn(20, 16, 50, 32, 16)
      >>> # pool of cubic window of size=3, and target output size 13x12x11
      >>> F.fractional_max_pool3d(input, 3, output_size=(13, 12, 11))
      >>> # pool of cubic window and target output size being half of input size
      >>> F.fractional_max_pool3d(input, 3, output_ratio=(0.5, 0.5, 0.5))
ConvBnReLU2d
class torch.ao.nn.intrinsic.qat.ConvBnReLU2d(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 ConvBnReLU2d module is a module fused from Conv2d, BatchNorm2d
   and ReLU, attached with FakeQuantize modules for weight, used in
   quantization aware training.
We combined the interface of "torch.nn.Conv2d" and
   "torch.nn.BatchNorm2d" and "torch.nn.ReLU".
Similar to torch.nn.Conv2d, with FakeQuantize modules initialized
   to default.
Variables:
      weight_fake_quant -- fake quant module for weight
ParametrizationList
class torch.nn.utils.parametrize.ParametrizationList(modules, original, unsafe=False)
A sequential container that holds and manages the "original" or
   "original0", "original1", ... parameters or buffers of a
   parametrized "torch.nn.Module".
It is the type of "module.parametrizations[tensor_name]" when
   "module[tensor_name]" has been parametrized with
   "register_parametrization()".
If the first registered parametrization has a "right_inverse" that
   returns one tensor or does not have a "right_inverse" (in which
   case we assume that "right_inverse" is the identity), it will hold
   the tensor under the name "original". If it has a "right_inverse"
   that returns more than one tensor, these will be registered as
   "original0", "original1", ...
Warning:
 This class is used internally by "register_parametrization()". It
 is documented here for completeness. It shall not be instantiated
 by the user.

Parameters:
by the user.
Parameters:
      * modules (sequence) -- sequence of modules representing
        the parametrizations
  * **original** (*Parameter** or **Tensor*) -- parameter or
    buffer that is parametrized

  * **unsafe** (*bool*) -- a boolean flag that denotes whether the
    parametrization may change the dtype and shape of the tensor.
    Default: *False* Warning: the parametrization is not checked
    for consistency upon registration. Enable this flag at your
    own risk.

right_inverse(value)
  Calls the methods "right_inverse" (see
  "register_parametrization()") of the parametrizations in the
  inverse order they were registered in. Then, it stores the
  result in "self.original" if "right_inverse" outputs one tensor
  or in "self.original0", "self.original1", ... if it outputs
  several.

  Parameters:
     **value** (*Tensor*) -- Value to which initialize the module
torch.stft
torch.stft(input, n_fft, hop_length=None, win_length=None, window=None, center=True, pad_mode='reflect', normalized=False, onesided=None, return_complex=None)
Short-time Fourier transform (STFT).
Warning:
 From version 1.8.0, "return_complex" must always be given
 explicitly for real inputs and *return_complex=False* has been
 deprecated. Strongly prefer *return_complex=True* as in a future
 pytorch release, this function will only return complex
 tensors.Note that "torch.view_as_real()" can be used to recover a
 real tensor with an extra last dimension for real and imaginary
 components.

The STFT computes the Fourier transform of short overlapping
   windows of the input. This giving frequency components of the
   signal as they change over time. The interface of this function is
   modeled after (but not a drop-in replacement for) librosa stft
   function.
Ignoring the optional batch dimension, this method computes the
following expression:
  X[\omega, m] = \sum_{k = 0}^{\text{win\_length-1}}%
  \text{window}[k]\ \text{input}[m \times \text{hop\_length} + k]\
  %                     \exp\left(- j \frac{2 \pi \cdot \omega
  k}{\text{win\_length}}\right),

where m is the index of the sliding window, and \omega is the
   frequency 0 \leq \omega < \text{n_fft} for "onesided=False", or 0
   \leq \omega < \lfloor \text{n_fft} / 2 \rfloor + 1 for
   "onesided=True".


"input" must be either a 1-D time sequence or a 2-D batch of time
     sequences.


If "hop_length" is "None" (default), it is treated as equal to
     "floor(n_fft / 4)".


If "win_length" is "None" (default), it is treated as equal to
     "n_fft".


"window" can be a 1-D tensor of size "win_length", e.g., from
     "torch.hann_window()". If "window" is "None" (default), it is
     treated as if having 1 everywhere in the window. If
     \text{win_length} < \text{n_fft}, "window" will be padded on
both sides to length "n_fft" before being applied.


If "center" is "True" (default), "input" will be padded on both
     sides so that the t-th frame is centered at time t \times
     \text{hop_length}. Otherwise, the t-th frame begins at time  t
     \times \text{hop_length}.


"pad_mode" determines the padding method used on "input" when
     "center" is "True". See "torch.nn.functional.pad()" for all
     available options. Default is ""reflect"".


If "onesided" is "True" (default for real input), only values for
     \omega in \left[0, 1, 2, \dots, \left\lfloor
     \frac{\text{n_fft}}{2} \right\rfloor + 1\right] are returned
     because the real-to-complex Fourier transform satisfies the
     conjugate symmetry, i.e., X[m, \omega] = X[m, \text{n_fft} -
     \omega]^*. Note if the input or window tensors are complex, then
     "onesided" output is not possible.


If "normalized" is "True" (default is "False"), the function
returns the normalized STFT results, i.e., multiplied by
     (\text{frame_length})^{-0.5}.

If "return_complex" is "True" (default if input is complex), the
     return is a "input.dim() + 1" dimensional complex tensor. If
     "False", the output is a "input.dim() + 2" dimensional real
     tensor where the last dimension represents the real and imaginary
     components.

Returns either a complex tensor of size ( \times N \times T) if
   "return_complex" is true, or a real tensor of size ( \times N
   \times T \times 2). Where * is the optional batch size of "input",
   N is the number of frequencies where STFT is applied and T is the
   total number of frames used.
Warning:
 This function changed signature at version 0.4.1. Calling with
 the previous signature may cause error or return incorrect
 result.

Parameters:
      * input (Tensor) -- the input tensor
  * **n_fft** (*int*) -- size of Fourier transform
hop_length (int, optional) -- the distance between
        neighboring sliding window frames. Default: "None" (treated as
        equal to "floor(n_fft / 4)")


win_length (int, optional) -- the size of window
    frame and STFT filter. Default: "None"  (treated as equal to
    "n_fft")


window (Tensor, optional) -- the optional window
    function. Default: "None" (treated as window of all 1 s)


center (bool, optional) -- whether to pad "input" on
    both sides so that the t-th frame is centered at time t \times
    \text{hop_length}. Default: "True"


pad_mode (str, optional) -- controls the padding
    method used when "center" is "True". Default: ""reflect""


normalized (bool, optional) -- controls whether to
    return the normalized STFT results Default: "False"


onesided (bool, optional) -- controls whether to
return half of results to avoid redundancy for real inputs.
        Default: "True" for real "input" and "window", "False"
        otherwise.
  * **return_complex** (*bool**, **optional*) --

    whether to return a complex tensor, or a real tensor with an
    extra last dimension for the real and imaginary components.

    Changed in version 2.0: "return_complex" is now a required
    argument for real inputs, as the default is being transitioned
    to "True".

    Deprecated since version 2.0: "return_complex=False" is
    deprecated, instead use "return_complex=True" Note that
    calling "torch.view_as_real()" on the output will recover the
    deprecated output format.

Returns:
      A tensor containing the STFT result with shape described above
Return type:
      Tensor
upsample_nearest
class torch.ao.nn.quantized.functional.upsample_nearest(input, size=None, scale_factor=None)
Upsamples the input, using nearest neighbours' pixel values.
Warning:
 This function is deprecated in favor of
 "torch.nn.quantized.functional.interpolate()". This is equivalent
 with "nn.quantized.functional.interpolate(..., mode='nearest')".

Note:
 The input quantization parameters propagate to the output.

Note:
 Only 2D inputs are supported

Parameters:
      * input (Tensor) -- quantized input
  * **size** (*int** or **Tuple**[**int**, **int**] or
    **Tuple**[**int**, **int**, **int**]*) -- output spatial size.

  * **scale_factor** (*int*) -- multiplier for spatial size. Has
    to be an integer.
torch.addmm
torch.addmm(input, mat1, mat2, *, beta=1, alpha=1, out=None) -> Tensor
Performs a matrix multiplication of the matrices "mat1" and "mat2".
   The matrix "input" is added to the final result.
If "mat1" is a (n \times m) tensor, "mat2" is a (m \times p)
   tensor, then "input" must be broadcastable with a (n \times p)
   tensor and "out" will be a (n \times p) tensor.
"alpha" and "beta" are scaling factors on matrix-vector product
   between "mat1" and "mat2" and the added matrix "input"
   respectively.
  \text{out} = \beta\ \text{input} + \alpha\ (\text{mat1}_i
  \mathbin{@} \text{mat2}_i)

If "beta" is 0, then "input" will be ignored, and nan and inf
   in it will not be propagated.
For inputs of type FloatTensor or DoubleTensor, arguments
   "beta" and "alpha" must be real numbers, otherwise they should be
   integers.
This operation has support for arguments with sparse layouts. If
"input" is sparse the result will have the same layout and if "out"
   is provided it must have the same layout as "input".
Warning:
 Sparse support is a beta feature and some layout(s)/dtype/device
 combinations may not be supported, or may not have autograd
 support. If you notice missing functionality please open a
 feature request.

This operator supports TensorFloat32.
On certain ROCm devices, when using float16 inputs this module will
   use different precision for backward.
Parameters:
      * input (Tensor) -- matrix to be added
  * **mat1** (*Tensor*) -- the first matrix to be matrix
    multiplied

  * **mat2** (*Tensor*) -- the second matrix to be matrix
    multiplied

Keyword Arguments:
      * beta (Number, optional) -- multiplier for "input"
        (\beta)
  * **alpha** (*Number**, **optional*) -- multiplier for mat1 @
    mat2 (\alpha)

  * **out** (*Tensor**, **optional*) -- the output tensor.

Example:
Example:
  >>> M = torch.randn(2, 3)
  >>> mat1 = torch.randn(2, 3)
  >>> mat2 = torch.randn(3, 3)
  >>> torch.addmm(M, mat1, mat2)
  tensor([[-4.8716,  1.4671, -1.3746],
          [ 0.7573, -3.9555, -2.8681]])
torch.quantized_max_pool2d
torch.quantized_max_pool2d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False) -> Tensor
Applies a 2D max pooling over an input quantized tensor composed of
   several input planes.
Parameters:
      * input (Tensor) -- quantized tensor
  * **kernel_size** ("list of int") -- the size of the sliding
    window

  * **stride** ("list of int", optional) -- the stride of the
    sliding window

  * **padding** ("list of int", optional) -- padding to be added
    on both sides, must be >= 0 and <= kernel_size / 2

  * **dilation** ("list of int", optional) -- The stride between
    elements within a sliding window, must be > 0. Default 1

  * **ceil_mode** (*bool**, **optional*) -- If True, will use ceil
    instead of floor to compute the output shape. Defaults to
    False.

Returns:
      A quantized tensor with max_pool2d applied.
Return type:
      Tensor
Example:
Return type:
      Tensor
Example:
  >>> qx = torch.quantize_per_tensor(torch.rand(2, 2, 2, 2), 1.5, 3, torch.quint8)
  >>> torch.quantized_max_pool2d(qx, [2,2])
  tensor([[[[1.5000]],

          [[1.5000]]],


          [[[0.0000]],

          [[0.0000]]]], size=(2, 2, 1, 1), dtype=torch.quint8,
      quantization_scheme=torch.per_tensor_affine, scale=1.5, zero_point=3)
ReLU
class torch.nn.ReLU(inplace=False)
Applies the rectified linear unit function element-wise:
\text{ReLU}(x) = (x)^+ = \max(0, x)
Parameters:
      inplace (bool) -- can optionally do the operation in-
      place. Default: "False"
Shape:
      * Input: (*), where * means any number of dimensions.
  * Output: (*), same shape as the input.

[image]
Examples:
    >>> m = nn.ReLU()
    >>> input = torch.randn(2)
    >>> output = m(input)


  An implementation of CReLU - https://arxiv.org/abs/1603.05201

    >>> m = nn.ReLU()
    >>> input = torch.randn(2).unsqueeze(0)
    >>> output = torch.cat((m(input), m(-input)))
torch.Tensor.put_
Tensor.put_(index, source, accumulate=False) -> Tensor
Copies the elements from "source" into the positions specified by
   "index". For the purpose of indexing, the "self" tensor is treated
   as if it were a 1-D tensor.
"index" and "source" need to have the same number of elements, but
   not necessarily the same shape.
If "accumulate" is "True", the elements in "source" are added to
   "self". If accumulate is "False", the behavior is undefined if
   "index" contain duplicate elements.
Parameters:
      * index (LongTensor) -- the indices into self
  * **source** (*Tensor*) -- the tensor containing values to copy
    from

  * **accumulate** (*bool*) -- whether to accumulate into self

Example:
  >>> src = torch.tensor([[4, 3, 5],
  ...                     [6, 7, 8]])
  >>> src.put_(torch.tensor([1, 3]), torch.tensor([9, 10]))
  tensor([[  4,   9,   5],
          [ 10,   7,   8]])
torch.Tensor.backward
Tensor.backward(gradient=None, retain_graph=None, create_graph=False, inputs=None)
Computes the gradient of current tensor w.r.t. graph leaves.
The graph is differentiated using the chain rule. If the tensor is
   non-scalar (i.e. its data has more than one element) and requires
   gradient, the function additionally requires specifying "gradient".
   It should be a tensor of matching type and location, that contains
   the gradient of the differentiated function w.r.t. "self".
This function accumulates gradients in the leaves - you might need
   to zero ".grad" attributes or set them to "None" before calling it.
   See Default gradient layouts for details on the memory layout of
   accumulated gradients.
Note:
 If you run any forward ops, create "gradient", and/or call
 "backward" in a user-specified CUDA stream context, see Stream
 semantics of backward passes.

Note:
semantics of backward passes.
Note:
 When "inputs" are provided and a given input is not a leaf, the
 current implementation will call its grad_fn (though it is not
 strictly needed to get this gradients). It is an implementation
 detail on which the user should not rely. See https://github.com
 /pytorch/pytorch/pull/60521#issuecomment-867061780 for more
 details.

Parameters:
      * gradient (Tensor or None) -- Gradient w.r.t. the
        tensor. If it is a tensor, it will be automatically converted
        to a Tensor that does not require grad unless "create_graph"
        is True. None values can be specified for scalar Tensors or
        ones that don't require grad. If a None value would be
        acceptable then this argument is optional.
  * **retain_graph** (*bool**, **optional*) -- If "False", the
    graph used to compute the grads will be freed. Note that in
    nearly all cases setting this option to True is not needed and
often can be worked around in a much more efficient way.
        Defaults to the value of "create_graph".
  * **create_graph** (*bool**, **optional*) -- If "True", graph of
    the derivative will be constructed, allowing to compute higher
    order derivative products. Defaults to "False".

  * **inputs** (*sequence of Tensor*) -- Inputs w.r.t. which the
    gradient will be accumulated into ".grad". All other Tensors
    will be ignored. If not provided, the gradient is accumulated
    into all the leaf Tensors that were used to compute the
    attr::tensors.
torch.Tensor.reshape_as
Tensor.reshape_as(other) -> Tensor
Returns this tensor as the same shape as "other".
   "self.reshape_as(other)" is equivalent to
   "self.reshape(other.sizes())". This method returns a view if
   "other.sizes()" is compatible with the current shape. See
   "torch.Tensor.view()" on when it is possible to return a view.
Please see "reshape()" for more information about "reshape".
Parameters:
      other ("torch.Tensor") -- The result tensor has the same
      shape as "other".
torch.nn.modules.module.register_module_forward_pre_hook
torch.nn.modules.module.register_module_forward_pre_hook(hook)
Registers a forward pre-hook common to all modules.
Warning:
 This adds global state to the *nn.module* module and it is only
 intended for debugging/profiling purposes.

The hook will be called every time before "forward()" is invoked.
   It should have the following signature:
  hook(module, input) -> None or modified input

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).
This hook has precedence over the specific module hooks registered
   with "register_forward_pre_hook".
Returns:
torch.nn.functional.prelu
torch.nn.functional.prelu(input, weight) -> Tensor
Applies element-wise the function \text{PReLU}(x) = \max(0,x) +
   \text{weight} * \min(0,x) where weight is a learnable parameter.
Note:
 *weight* is expected to be a scalar or 1-D tensor. If *weight* is
 1-D, its size must match the number of input channels, determined
 by *input.size(1)* when *input.dim() >= 2*, otherwise 1. In the
 1-D case, note that when *input* has dim > 2, *weight* can be
 expanded to the shape of *input* in a way that is not possible
 using normal broadcasting semantics.

See "PReLU" for more details.
torch.fft.irfft
torch.fft.irfft(input, n=None, dim=- 1, norm=None, *, out=None) -> Tensor
Computes the inverse of "rfft()".
"input" is interpreted as a one-sided Hermitian signal in the
   Fourier domain, as produced by "rfft()". By the Hermitian property,
   the output will be real-valued.
Note:
 Some input frequencies must be real-valued to satisfy the
 Hermitian property. In these cases the imaginary component will
 be ignored. For example, any imaginary component in the zero-
 frequency term cannot be represented in a real output and so will
 always be ignored.

Note:
 The correct interpretation of the Hermitian input depends on the
 length of the original data, as given by "n". This is because
 each input shape could correspond to either an odd or even length
 signal. By default, the signal is assumed to be even length and
 odd signals will not round-trip properly. So, it is recommended
 to always pass the signal length "n".
to always pass the signal length "n".
Note:
 Supports torch.half and torch.chalf on CUDA with GPU Architecture
 SM53 or greater. However it only supports powers of 2 signal
 length in every transformed dimension. With default arguments,
 size of the transformed dimension should be (2^n + 1) as argument
 *n* defaults to even output size = 2 * (transformed_dim_size - 1)

Parameters:
      * input (Tensor) -- the input tensor representing a half-
        Hermitian signal
  * **n** (*int**, **optional*) -- Output signal length. This
    determines the length of the output signal. If given, the
    input will either be zero-padded or trimmed to this length
    before computing the real IFFT. Defaults to even output:
    "n=2*(input.size(dim) - 1)".

  * **dim** (*int**, **optional*) -- The dimension along which to
    take the one dimensional real IFFT.

  * **norm** (*str**, **optional*) --
norm (str, optional) --Normalization mode. For the backward transform ("irfft()"),
these correspond to:

* ""forward"" - no normalization

* ""backward"" - normalize by "1/n"

* ""ortho"" - normalize by "1/sqrt(n)" (making the real IFFT
  orthonormal)

Calling the forward transform ("rfft()") with the same
normalization mode will apply an overall normalization of
"1/n" between the two transforms. This is required to make
"irfft()" the exact inverse.

Default is ""backward"" (normalize by "1/n").



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



t = torch.linspace(0, 1, 5)
t
   tensor([0.0000, 0.2500, 0.5000, 0.7500, 1.0000])
T = torch.fft.rfft(t)
T
   tensor([ 2.5000+0.0000j, -0.6250+0.8602j, -0.6250+0.2031j])



Without specifying the output length to "irfft()", the output will
not round-trip properly because the input is odd-length:



torch.fft.irfft(T)
   tensor([0.1562, 0.3511, 0.7812, 1.2114])



So, it is recommended to always pass the signal length "n":



roundtrip = torch.fft.irfft(T, t.numel())
torch.testing.assert_close(roundtrip, t, check_stride=False)
torch.hamming_window
torch.hamming_window(window_length, periodic=True, alpha=0.54, beta=0.46, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor
Hamming window function.
  w[n] = \alpha - \beta\ \cos \left( \frac{2 \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.hamming_window(L, periodic=True)" equal to
   "torch.hamming_window(L + 1, periodic=False)[:-1])".
Note:
 If "window_length" =1, the returned window contains a single
 value 1.

Note:
value 1.
Note:
 This is a generalized version of "torch.hann_window()".

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.

  * **alpha** (*float**, **optional*) -- The coefficient \alpha in
    the equation above

  * **beta** (*float**, **optional*) -- The coefficient \beta in
    the equation above

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.
  * **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