shrinath-suresh/blogs-docs-splitted huggingface dataset:
torch.hann_window
torch.hann_window(window_length, periodic=True, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor
Hann window function.
  w[n] = \frac{1}{2}\ \left[1 - \cos \left( \frac{2 \pi n}{N - 1}
  \right)\right] =         \sin^2 \left( \frac{\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.hann_window(L, periodic=True)" equal to
   "torch.hann_window(L + 1, periodic=False)[:-1])".
Note:
 If "window_length" =1, the returned window contains a single
 value 1.

Parameters:
fuse_fx
class torch.quantization.quantize_fx.fuse_fx(model, fuse_custom_config=None, backend_config=None)
Fuse modules like conv+bn, conv+bn+relu etc, model must be in eval
   mode. Fusion rules are defined in
   torch.quantization.fx.fusion_pattern.py
Parameters:
      * model (***) -- a torch.nn.Module model
  * **fuse_custom_config** (***) -- custom configurations for
    fuse_fx. See "FuseCustomConfig" for more details

Return type:
      GraphModule
Example:
  from torch.ao.quantization import fuse_fx
  m = Model().eval()
  m = fuse_fx(m)
torch.linalg.solve
torch.linalg.solve(A, B, *, left=True, out=None) -> Tensor
Computes the solution of a square system of linear equations with a
   unique solution.
Letting \mathbb{K} be \mathbb{R} or \mathbb{C}, this function
   computes the solution X \in \mathbb{K}^{n \times k} of the linear
   system associated to A \in \mathbb{K}^{n \times n}, B \in
   \mathbb{K}^{n \times k}, which is defined as
  AX = B

If "left"= False, this function returns the matrix X \in
   \mathbb{K}^{n \times k} that solves the system
  XA = B\mathrlap{\qquad A \in \mathbb{K}^{k \times k}, B \in
  \mathbb{K}^{n \times k}.}

This system of linear equations has one solution if and only if A
   is invertible. This function assumes that A is invertible.
Supports inputs of float, double, cfloat and cdouble dtypes. Also
   supports batches of matrices, and if the inputs are batches of
   matrices then the output has the same batch dimensions.
Letting *** be zero or more batch dimensions,


If "A" has shape (, n, n) and "B" has shape (, n) (a batch
     of vectors) or shape (, n, k) (a batch of matrices or
     "multiple right-hand sides"), this function returns X of shape
     (, n) or (, n, k)* respectively.


Otherwise, if "A" has shape (, n, n) and  "B" has shape (n,)
     or (n, k), "B" is broadcasted to have shape (, n) or (, n,
     k)* respectively. This function then returns the solution of the
     resulting batch of systems of linear equations.


Note:
 This function computes *X = *"A"*.inverse() @ *"B" in a faster
 and more numerically stable way than performing the computations
 separately.

Note:
 It is possible to compute the solution of the system XA = B by
 passing the inputs "A" and "B" transposed and transposing the
 output returned by this function.

Note:
 When inputs are on a CUDA device, this function synchronizes that
 device with the CPU.
device with the CPU.
See also:
 "torch.linalg.solve_triangular()" computes the solution of a
 triangular system of linear equations with a unique solution.

Parameters:
      * A (Tensor) -- tensor of shape (, n, n)* where *** is
        zero or more batch dimensions.
  * **B** (*Tensor*) -- right-hand side tensor of shape *(*, n)*
    or  *(*, n, k)* or *(n,)* or *(n, k)* according to the rules
    described above

Keyword Arguments:
      * left (bool, optional) -- whether to solve the system
        AX=B or XA = B. Default: True.
  * **out** (*Tensor**, **optional*) -- output tensor. Ignored if
    *None*. Default: *None*.

Raises:
      RuntimeError -- if the "A" matrix is not invertible or any
      matrix in a batched "A"     is not invertible.
Examples:
  >>> A = torch.randn(3, 3)
  >>> b = torch.randn(3)
  >>> x = torch.linalg.solve(A, b)
  >>> torch.allclose(A @ x, b)
  True
torch.allclose(A @ x, b)
      True
      >>> A = torch.randn(2, 3, 3)
      >>> B = torch.randn(2, 3, 4)
      >>> X = torch.linalg.solve(A, B)
      >>> X.shape
      torch.Size([2, 3, 4])
      >>> torch.allclose(A @ X, B)
      True



  >>> A = torch.randn(2, 3, 3)
  >>> b = torch.randn(3, 1)
  >>> x = torch.linalg.solve(A, b) # b is broadcasted to size (2, 3, 1)
  >>> x.shape
  torch.Size([2, 3, 1])
  >>> torch.allclose(A @ x, b)
  True
  >>> b = torch.randn(3)
  >>> x = torch.linalg.solve(A, b) # b is broadcasted to size (2, 3)
  >>> x.shape
  torch.Size([2, 3])
  >>> Ax = A @ x.unsqueeze(-1)
  >>> torch.allclose(Ax, b.unsqueeze(-1).expand_as(Ax))
  True
torch.polar
torch.polar(abs, angle, *, out=None) -> Tensor
Constructs a complex tensor whose elements are Cartesian
   coordinates corresponding to the polar coordinates with absolute
   value "abs" and angle "angle".
  \text{out} = \text{abs} \cdot \cos(\text{angle}) + \text{abs}
  \cdot \sin(\text{angle}) \cdot j

Note:
 *torch.polar* is similar to std::polar and does not compute the
 polar decomposition of a complex tensor like Python's
 *cmath.polar* and SciPy's *linalg.polar* do. The behavior of this
 function is undefined if *abs* is negative or NaN, or if *angle*
 is infinite.

Parameters:
      * abs (Tensor) -- The absolute value the complex tensor.
        Must be float or double.
  * **angle** (*Tensor*) -- The angle of the complex tensor. Must
    be same dtype as "abs".

Keyword Arguments:
      out (Tensor) -- If the inputs are "torch.float32", must be
      "torch.complex64". If the inputs are "torch.float64", must be
"torch.complex128".
Example:
  >>> import numpy as np
  >>> abs = torch.tensor([1, 2], dtype=torch.float64)
  >>> angle = torch.tensor([np.pi / 2, 5 * np.pi / 4], dtype=torch.float64)
  >>> z = torch.polar(abs, angle)
  >>> z
  tensor([(0.0000+1.0000j), (-1.4142-1.4142j)], dtype=torch.complex128)
torch.numel
torch.numel(input) -> int
Returns the total number of elements in the "input" tensor.
Parameters:
      input (Tensor) -- the input tensor.
Example:
  >>> a = torch.randn(1, 2, 3, 4, 5)
  >>> torch.numel(a)
  120
  >>> a = torch.zeros(4,4)
  >>> torch.numel(a)
  16
torch.lt
torch.lt(input, other, *, out=None) -> Tensor
Computes \text{input} < \text{other} element-wise.
The second argument can be a number or a tensor whose shape is
   broadcastable with the first argument.
Parameters:
      * input (Tensor) -- the tensor to compare
  * **other** (*Tensor** or **float*) -- the tensor or value to
    compare

Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Returns:
      A boolean tensor that is True where "input" is less than "other"
      and False elsewhere
Example:
  >>> torch.lt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]))
  tensor([[False, False], [True, False]])
torch.triu_indices
torch.triu_indices(row, col, offset=0, *, dtype=torch.long, device='cpu', layout=torch.strided) -> Tensor
Returns the indices of the upper triangular part of a "row" by
   "col" matrix in a 2-by-N Tensor, where the first row contains row
   coordinates of all indices and the second row contains column
   coordinates. Indices are ordered based on rows and then columns.
The upper triangular part of the matrix is defined as the elements
   on and above the diagonal.
The argument "offset" controls which diagonal to consider. If
   "offset" = 0, all elements on and above the main diagonal are
   retained. A positive value excludes just as many diagonals above
   the main diagonal, and similarly a negative value includes just as
   many diagonals below the main diagonal. The main diagonal are the
   set of indices \lbrace (i, i) \rbrace for i \in [0, \min{d_{1},
   d_{2}} - 1] where d_{1}, d_{2} are the dimensions of the matrix.
Note:
Note:
 When running on CUDA, "row * col" must be less than 2^{59} to
 prevent overflow during calculation.

Parameters:
      * row ("int") -- number of rows in the 2-D matrix.
  * **col** ("int") -- number of columns in the 2-D matrix.

  * **offset** ("int") -- diagonal offset from the main diagonal.
    Default: if not provided, 0.

Keyword Arguments:
      * dtype ("torch.dtype", optional) -- the desired data type
        of returned tensor. Default: if "None", "torch.long".
  * **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.

  * **layout** ("torch.layout", optional) -- currently only
    support "torch.strided".

Example:
  >>> a = torch.triu_indices(3, 3)
a = torch.triu_indices(3, 3)
      >>> a
      tensor([[0, 0, 0, 1, 1, 2],
              [0, 1, 2, 1, 2, 2]])



  >>> a = torch.triu_indices(4, 3, -1)
  >>> a
  tensor([[0, 0, 0, 1, 1, 1, 2, 2, 3],
          [0, 1, 2, 0, 1, 2, 1, 2, 2]])

  >>> a = torch.triu_indices(4, 3, 1)
  >>> a
  tensor([[0, 0, 1],
          [1, 2, 2]])
LazyInstanceNorm1d
class torch.nn.LazyInstanceNorm1d(eps=1e-05, momentum=0.1, affine=True, track_running_stats=True, device=None, dtype=None)
A "torch.nn.InstanceNorm1d" module with lazy initialization of the
   "num_features" argument of the "InstanceNorm1d" that is inferred
   from the "input.size(1)". The attributes that will be lazily
   initialized are weight, bias, running_mean and running_var.
Check the "torch.nn.modules.lazy.LazyModuleMixin" for further
   documentation on lazy modules and their limitations.
Parameters:
      * num_features -- C from an expected input of size (N, C, L)
        or (C, L)
  * **eps** (*float*) -- a value added to the denominator for
    numerical stability. Default: 1e-5

  * **momentum** (*float*) -- the value used for the running_mean
    and running_var computation. Default: 0.1

  * **affine** (*bool*) -- a boolean value that when set to
    "True", this module has learnable affine parameters,
initialized the same way as done for batch normalization.
        Default: "False".
  * **track_running_stats** (*bool*) -- a boolean value that when
    set to "True", this module tracks the running mean and
    variance, and when set to "False", this module does not track
    such statistics and always uses batch statistics in both
    training and eval modes. Default: "False"

Shape:
      * Input: (N, C, L) or (C, L)
  * Output: (N, C, L) or (C, L) (same shape as input)

cls_to_become
  alias of "InstanceNorm1d"
torch.fake_quantize_per_channel_affine
torch.fake_quantize_per_channel_affine(input, scale, zero_point, quant_min, quant_max) -> Tensor
Returns a new tensor with the data in "input" fake quantized per
   channel using "scale", "zero_point", "quant_min" and "quant_max",
   across the channel specified by "axis".
  \text{output} = min(     \text{quant\_max},     max(
  \text{quant\_min},         \text{std::nearby\_int}(\text{input}
  / \text{scale}) + \text{zero\_point}     ) )

Parameters:
      * input (Tensor) -- the input value(s), in "torch.float32"
  * **scale** (*Tensor*) -- quantization scale, per channel in
    "torch.float32"

  * **zero_point** (*Tensor*) -- quantization zero_point, per
    channel in "torch.int32" or "torch.half" or "torch.float32"

  * **axis** (*int32*) -- channel axis

  * **quant_min** (*int64*) -- lower bound of the quantized domain
quant_max (int64) -- upper bound of the quantized domain

Returns:
      A newly fake_quantized per channel "torch.float32" tensor
Return type:
      Tensor
Example:
  >>> x = torch.randn(2, 2, 2)
  >>> x
  tensor([[[-0.2525, -0.0466],
           [ 0.3491, -0.2168]],

          [[-0.5906,  1.6258],
           [ 0.6444, -0.0542]]])
  >>> scales = (torch.randn(2) + 1) * 0.05
  >>> scales
  tensor([0.0475, 0.0486])
  >>> zero_points = torch.zeros(2).to(torch.int32)
  >>> zero_points
  tensor([0, 0])
  >>> torch.fake_quantize_per_channel_affine(x, scales, zero_points, 1, 0, 255)
  tensor([[[0.0000, 0.0000],
           [0.3405, 0.0000]],

          [[0.0000, 1.6134],
          [0.6323, 0.0000]]])
torch.nn.functional.instance_norm
torch.nn.functional.instance_norm(input, running_mean=None, running_var=None, weight=None, bias=None, use_input_stats=True, momentum=0.1, eps=1e-05)
Applies Instance Normalization for each channel in each data sample
   in a batch.
See "InstanceNorm1d", "InstanceNorm2d", "InstanceNorm3d" for
   details.
Return type:
      Tensor
torch.Tensor.random_
Tensor.random_(from=0, to=None, *, generator=None) -> Tensor
Fills "self" tensor with numbers sampled from the discrete uniform
   distribution over "[from, to - 1]". If not specified, the values
   are usually only bounded by "self" tensor's data type. However, for
   floating point types, if unspecified, range will be "[0,
   2^mantissa]" to ensure that every value is representable. For
   example, torch.tensor(1, dtype=torch.double).random_() will be
   uniform in "[0, 2^53]".
per_channel_dynamic_qconfig
torch.quantization.qconfig.per_channel_dynamic_qconfig
alias of QConfig(activation=functools.partial(,
   dtype=torch.quint8, quant_min=0, quant_max=255, is_dynamic=True){},
   weight=functools.partial(,
   dtype=torch.qint8, qscheme=torch.per_channel_symmetric){})
torch.fft.ihfftn
torch.fft.ihfftn(input, s=None, dim=None, norm=None, *, out=None) -> Tensor
Computes the N-dimensional inverse discrete Fourier transform of
   real "input".
"input" must be a real-valued signal, interpreted in the Fourier
   domain. The n-dimensional IFFT of a real signal is Hermitian-
   symmetric, "X[i, j, ...] = conj(X[-i, -j, ...])". "ihfftn()"
   represents this in the one-sided form where only the positive
   frequencies below the Nyquist frequency are included in the last
   signal dimension. To compute the full output, use "ifftn()".
Note:
 Supports torch.half on CUDA with GPU Architecture SM53 or
 greater. However it only supports powers of 2 signal length in
 every transformed dimensions.

Parameters:
      * input (Tensor) -- the input tensor
  * **s** (*Tuple**[**int**]**, **optional*) -- Signal size in the
    transformed dimensions. If given, each dimension "dim[i]" will
either be zero-padded or trimmed to the length "s[i]" before
        computing the Hermitian IFFT. If a length "-1" is specified,
        no padding is done in that dimension. Default: "s =
        [input.size(d) for d in dim]"
  * **dim** (*Tuple**[**int**]**, **optional*) -- Dimensions to be
    transformed. Default: all dimensions, or the last "len(s)"
    dimensions if "s" is given.

  * **norm** (*str**, **optional*) --

    Normalization mode. For the backward transform ("ihfftn()"),
    these correspond to:

    * ""forward"" - no normalization

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

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

    Where "n = prod(s)" is the logical IFFT size. Calling the
    forward transform ("hfftn()") with the same normalization mode
    will apply an overall normalization of "1/n" between the two
    transforms. This is required to make "ihfftn()" the exact
inverse.
    Default is ""backward"" (normalize by "1/n").

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



T = torch.rand(10, 10)
ihfftn = torch.fft.ihfftn(T)
ihfftn.size()
   torch.Size([10, 6])



Compared against the full output from "ifftn()", we have all
   elements up to the Nyquist frequency.



ifftn = torch.fft.ifftn(t)
torch.allclose(ifftn[..., :6], ihfftn)
   True



The discrete Fourier transform is separable, so "ihfftn()" here is
   equivalent to a combination of "ihfft()" and "ifft()":



two_iffts = torch.fft.ifft(torch.fft.ihfft(t, dim=1), dim=0)
torch.allclose(ihfftn, two_iffts)
   True
torch.isnan
torch.isnan(input) -> Tensor
Returns a new tensor with boolean elements representing if each
   element of "input" is NaN or not. Complex values are considered NaN
   when either their real and/or imaginary part is NaN.
Parameters:
      input (Tensor) -- the input tensor.
Returns:
      A boolean tensor that is True where "input" is NaN and False
      elsewhere
Example:
  >>> torch.isnan(torch.tensor([1, float('nan'), 2]))
  tensor([False, True, False])
torch.linalg.eigvals
torch.linalg.eigvals(A, *, out=None) -> Tensor
Computes the eigenvalues of a square matrix.
Letting \mathbb{K} be \mathbb{R} or \mathbb{C}, the eigenvalues
   of a square matrix A \in \mathbb{K}^{n \times n} are defined as the
   roots (counted with multiplicity) of the polynomial p of degree
   n given by
  p(\lambda) = \operatorname{det}(A - \lambda
  \mathrm{I}_n)\mathrlap{\qquad \lambda \in \mathbb{C}}

where \mathrm{I}_n is the n-dimensional identity matrix.
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.
Note:
 The eigenvalues of a real matrix may be complex, as the roots of
 a real polynomial may be complex.The eigenvalues of a matrix are
 always well-defined, even when the matrix is not diagonalizable.

Note:
Note:
 When inputs are on a CUDA device, this function synchronizes that
 device with the CPU.

See also:
 "torch.linalg.eig()" computes the full eigenvalue decomposition.

Parameters:
      A (Tensor) -- tensor of shape (, n, n)* where *** is
      zero or more batch dimensions.
Keyword Arguments:
      out (Tensor, optional) -- output tensor. Ignored if
      None. Default: None.
Returns:
      A complex-valued tensor containing the eigenvalues even when "A"
      is real.
Examples:
  >>> A = torch.randn(2, 2, dtype=torch.complex128)
  >>> L = torch.linalg.eigvals(A)
  >>> L
  tensor([ 1.1226+0.5738j, -0.7537-0.1286j], dtype=torch.complex128)

  >>> torch.dist(L, torch.linalg.eig(A).eigenvalues)
  tensor(2.4576e-07)
torch.amin
torch.amin(input, dim, keepdim=False, *, out=None) -> Tensor
Returns the minimum value of each slice of the "input" tensor in
   the given dimension(s) "dim".
Note:
 The difference between "max"/"min" and "amax"/"amin" is:
    * "amax"/"amin" supports reducing on multiple dimensions,

    * "amax"/"amin" does not return indices,

    * "amax"/"amin" evenly distributes gradient between equal
      values, while "max(dim)"/"min(dim)" propagates gradient only
      to a single index in the source tensor.

If "keepdim" is "True", the output tensor is of the same size as
   "input" except in the dimension(s) "dim" where it is of size 1.
   Otherwise, "dim" is squeezed (see "torch.squeeze()"), resulting in
   the output tensor having 1 (or "len(dim)") fewer dimension(s).
Parameters:
      * input (Tensor) -- the input tensor.
  * **dim** (*int** or **tuple of ints*) -- the dimension or
    dimensions to reduce.
dimensions to reduce.
  * **keepdim** (*bool*) -- whether the output tensor has "dim"
    retained or not.

Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Example:
  >>> a = torch.randn(4, 4)
  >>> a
  tensor([[ 0.6451, -0.4866,  0.2987, -1.3312],
          [-0.5744,  1.2980,  1.8397, -0.2713],
          [ 0.9128,  0.9214, -1.7268, -0.2995],
          [ 0.9023,  0.4853,  0.9075, -1.6165]])
  >>> torch.amin(a, 1)
  tensor([-1.3312, -0.5744, -1.7268, -1.6165])
torch.ones_like
torch.ones_like(input, *, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor
Returns a tensor filled with the scalar value 1, with the same
   size as "input". "torch.ones_like(input)" is equivalent to
   "torch.ones(input.size(), dtype=input.dtype, layout=input.layout,
   device=input.device)".
Warning:
 As of 0.4, this function does not support an "out" keyword. As an
 alternative, the old "torch.ones_like(input, out=output)" is
 equivalent to "torch.ones(input.size(), out=output)".

Parameters:
      input (Tensor) -- the size of "input" will determine size
      of the output tensor.
Keyword Arguments:
      * dtype ("torch.dtype", optional) -- the desired data type
        of returned Tensor. Default: if "None", defaults to the dtype
        of "input".
  * **layout** ("torch.layout", optional) -- the desired layout of
returned tensor. Default: if "None", defaults to the layout of
        "input".
  * **device** ("torch.device", optional) -- the desired device of
    returned tensor. Default: if "None", defaults to the device of
    "input".

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

  * **memory_format** ("torch.memory_format", optional) -- the
    desired memory format of returned Tensor. Default:
    "torch.preserve_format".

Example:
  >>> input = torch.empty(2, 3)
  >>> torch.ones_like(input)
  tensor([[ 1.,  1.,  1.],
          [ 1.,  1.,  1.]])
torch.sub
torch.sub(input, other, *, alpha=1, out=None) -> Tensor
Subtracts "other", scaled by "alpha", from "input".
  \text{{out}}_i = \text{{input}}_i - \text{{alpha}} \times
  \text{{other}}_i

Supports broadcasting to a common shape, type promotion, and
   integer, float, and complex inputs.
Parameters:
      * input (Tensor) -- the input tensor.
  * **other** (*Tensor** or **Number*) -- the tensor or number to
    subtract from "input".

Keyword Arguments:
      * alpha (Number) -- the multiplier for "other".
  * **out** (*Tensor**, **optional*) -- the output tensor.

Example:
  >>> a = torch.tensor((1, 2))
  >>> b = torch.tensor((0, 1))
  >>> torch.sub(a, b, alpha=2)
  tensor([1, 0])
QConfigMapping
class torch.ao.quantization.qconfig_mapping.QConfigMapping
Mapping from model ops to "torch.ao.quantization.QConfig" s.
The user can specify QConfigs using the following methods (in
   increasing match priority):
  "set_global" : sets the global (default) QConfig

  "set_object_type" : sets the QConfig for a given module type,
  function, or method name

  "set_module_name_regex" : sets the QConfig for modules matching
  the given regex string

  "set_module_name" : sets the QConfig for modules matching the
  given module name

  "set_module_name_object_type_order" : sets the QConfig for
  modules matching a combination of the given module name, object
  type, and the index at which the module appears

Example usage:
  qconfig_mapping = QConfigMapping()
      .set_global(global_qconfig)
      .set_object_type(torch.nn.Linear, qconfig1)
      .set_object_type(torch.nn.ReLU, qconfig1)
.set_module_name_regex("foo.bar.conv[0-9]+", qconfig1)
          .set_module_name_regex("foo.*", qconfig2)
          .set_module_name("module1", qconfig1)
          .set_module_name("module2", qconfig2)
          .set_module_name_object_type_order("foo.bar", torch.nn.functional.linear, 0, qconfig3)
classmethod from_dict(qconfig_dict)
  Create a "QConfigMapping" from a dictionary with the following
  keys (all optional):

     "" (for global QConfig)

     "object_type"

     "module_name_regex"

     "module_name"

     "module_name_object_type_order"

  The values of this dictionary are expected to be lists of
  tuples.

  Return type:
     *QConfigMapping*

set_global(global_qconfig)
  Set the global (default) QConfig.

  Return type:
     *QConfigMapping*

set_module_name(module_name, qconfig)
  Set the QConfig for modules matching the given module name. If