shrinath-suresh/blogs-docs-splitted huggingface dataset:
Set the pattern to configure.
  The pattern can be a float module, functional operator, pytorch
  operator, or a tuple combination of the above. Tuple patterns
  are treated as sequential patterns, and currently only tuples of
  2 or 3 elements are supported.

  Return type:
     *BackendPatternConfig*

set_qat_module(qat_module)
  Set the module that represents the QAT implementation for this
  pattern.

  Return type:
     *BackendPatternConfig*

set_reference_quantized_module(reference_quantized_module)
  Set the module that represents the reference quantized
  implementation for this pattern's root module.

  For more detail, see "set_root_module()".

  Return type:
     *BackendPatternConfig*

set_root_module(root_module)
  Set the module that represents the root for this pattern.

  When we construct the reference quantized model during the
  convert phase, the root modules (e.g. torch.nn.Linear for
torch.ao.nn.intrinsic.LinearReLU) will be swapped to the
      corresponding reference quantized modules (e.g.
      torch.ao.nn.reference.quantized.Linear). This allows custom
      backends to specify custom reference quantized module
      implementations to match the numerics of their lowered
      operators. Since this is a one-to-one mapping, both the root
      module and the reference quantized module must be specified in
      the same BackendPatternConfig in order for the conversion to
      take place.
  Return type:
     *BackendPatternConfig*

to_dict()
  Convert this "BackendPatternConfig" to a dictionary with the
  items described in "from_dict()".

  Return type:
     *Dict*[str, *Any*]
torch.randn
torch.randn(size, , out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor
Returns a tensor filled with random numbers from a normal
   distribution with mean 0 and variance 1 (also called the
   standard normal distribution).
  \text{out}_{i} \sim \mathcal{N}(0, 1)

The shape of the tensor is defined by the variable argument "size".
Parameters:
      size (int...) -- a sequence of integers defining the
      shape of the output tensor. Can be a variable number of
      arguments or a collection like a list or tuple.
Keyword Arguments:
      * generator ("torch.Generator", optional) -- a pseudorandom
        number generator for sampling
  * **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()").
(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".

  * **pin_memory** (*bool**, **optional*) -- If set, returned
    tensor would be allocated in the pinned memory. Works only for
    CPU tensors. Default: "False".

Example:
  >>> torch.randn(4)
  tensor([-2.1436,  0.9966,  2.3426, -0.6366])
  >>> torch.randn(2, 3)
  tensor([[ 1.5954,  2.8929, -1.0923],
torch.linalg.lu_solve
torch.linalg.lu_solve(LU, pivots, B, *, left=True, adjoint=False, out=None) -> Tensor
Computes the solution of a square system of linear equations with a
   unique solution given an LU decomposition.
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

where A is given factorized as returned by "lu_factor()".
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}.}

If  "adjoint"= True (and "left"= True), given an LU
   factorization of :math:`A this function function returns the X \in
   \mathbb{K}^{n \times k} that solves the system
\mathbb{K}^{n \times k} that solves the system
  A^{\text{H}}X = B\mathrlap{\qquad A \in \mathbb{K}^{k \times k},
  B \in \mathbb{K}^{n \times k}.}

where A^{\text{H}} is the conjugate transpose when A is complex,
   and the transpose when A is real-valued. The "left"= False case
   is analogous.
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.
Parameters:
      * LU (Tensor) -- tensor of shape (, n, n) (or (, k,
        k) if "left"= True) where *** is zero or more batch
        dimensions as returned by "lu_factor()".
  * **pivots** (*Tensor*) -- tensor of shape *(*, n)* (or *(*, k)*
    if "left"*= True*) where *** is zero or more batch dimensions
    as returned by "lu_factor()".

  * **B** (*Tensor*) -- right-hand side tensor of shape *(*, n,
    k)*.

Keyword Arguments:
k)*.
Keyword Arguments:
      * left (bool, optional) -- whether to solve the system
        AX=B or XA = B. Default: True.
  * **adjoint** (*bool**, **optional*) -- whether to solve the
    system AX=B or A^{\text{H}}X = B. Default: *False*.

  * **out** (*Tensor**, **optional*) -- output tensor. Ignored if
    *None*. Default: *None*.

Examples:
  >>> A = torch.randn(3, 3)
  >>> LU, pivots = torch.linalg.lu_factor(A)
  >>> B = torch.randn(3, 2)
  >>> X = torch.linalg.lu_solve(LU, pivots, B)
  >>> torch.allclose(A @ X, B)
  True

  >>> B = torch.randn(3, 3, 2)   # Broadcasting rules apply: A is broadcasted
  >>> X = torch.linalg.lu_solve(LU, pivots, B)
  >>> torch.allclose(A @ X, B)
  True

  >>> B = torch.randn(3, 5, 3)
  >>> X = torch.linalg.lu_solve(LU, pivots, B, left=False)
  >>> torch.allclose(X @ A, B)
  True

  >>> B = torch.randn(3, 3, 4)   # Now solve for A^T
torch.sgn
torch.sgn(input, *, out=None) -> Tensor
This function is an extension of torch.sign() to complex tensors.
   It computes a new tensor whose elements have the same angles as the
   corresponding elements of "input" and absolute values (i.e.
   magnitudes) of one for complex tensors and is equivalent to
   torch.sign() for non-complex tensors.
  \text{out}_{i} = \begin{cases}                 0 &
  |\text{{input}}_i| == 0 \\
  \frac{{\text{{input}}_i}}{|{\text{{input}}_i}|} &
  \text{otherwise}                 \end{cases}

Parameters:
      input (Tensor) -- the input tensor.
Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Example:
  >>> t = torch.tensor([3+4j, 7-24j, 0, 1+2j])
  >>> t.sgn()
  tensor([0.6000+0.8000j, 0.2800-0.9600j, 0.0000+0.0000j, 0.4472+0.8944j])
torch.as_tensor
torch.as_tensor(data, dtype=None, device=None) -> Tensor
Converts "data" into a tensor, sharing data and preserving autograd
   history if possible.
If "data" is already a tensor with the requested dtype and device
   then "data" itself is returned, but if "data" is a tensor with a
   different dtype or device then it's copied as if using
   data.to(dtype=dtype, device=device).
If "data" is a NumPy array (an ndarray) with the same dtype and
   device then a tensor is constructed using "torch.from_numpy()".
See also:
 "torch.tensor()" never shares its data and creates a new "leaf
 tensor" (see Autograd mechanics).

Parameters:
      * data (array_like) -- Initial data for the tensor. Can be
        a list, tuple, NumPy "ndarray", scalar, and other types.
  * **dtype** ("torch.dtype", optional) -- the desired data type
    of returned tensor. Default: if "None", infers data type from
    "data".
"data".
  * **device** ("torch.device", optional) -- the device of the
    constructed tensor. If None and data is a tensor then the
    device of data is used. If None and data is not a tensor then
    the result tensor is constructed on the CPU.

Example:
  >>> a = numpy.array([1, 2, 3])
  >>> t = torch.as_tensor(a)
  >>> t
  tensor([ 1,  2,  3])
  >>> t[0] = -1
  >>> a
  array([-1,  2,  3])

  >>> a = numpy.array([1, 2, 3])
  >>> t = torch.as_tensor(a, device=torch.device('cuda'))
  >>> t
  tensor([ 1,  2,  3])
  >>> t[0] = -1
  >>> a
  array([1,  2,  3])
torch.nn.functional.softplus
torch.nn.functional.softplus(input, beta=1, threshold=20) -> Tensor
Applies element-wise, the function \text{Softplus}(x) =
   \frac{1}{\beta} * \log(1 + \exp(\beta * x)).
For numerical stability the implementation reverts to the linear
   function when input \times \beta > threshold.
See "Softplus" for more details.
torch.tile
torch.tile(input, dims) -> Tensor
Constructs a tensor by repeating the elements of "input". The
   "dims" argument specifies the number of repetitions in each
   dimension.
If "dims" specifies fewer dimensions than "input" has, then ones
   are prepended to "dims" until all dimensions are specified. For
   example, if "input" has shape (8, 6, 4, 2) and "dims" is (2, 2),
   then "dims" is treated as (1, 1, 2, 2).
Analogously, if "input" has fewer dimensions than "dims" specifies,
   then "input" is treated as if it were unsqueezed at dimension zero
   until it has as many dimensions as "dims" specifies. For example,
   if "input" has shape (4, 2) and "dims" is (3, 3, 2, 2), then
   "input" is treated as if it had the shape (1, 1, 4, 2).
Note:
 This function is similar to NumPy's tile function.

Parameters:
      * input (Tensor) -- the tensor whose elements to repeat.
  * **dims** (*tuple*) -- the number of repetitions per dimension.

Example:
Example:
  >>> x = torch.tensor([1, 2, 3])
  >>> x.tile((2,))
  tensor([1, 2, 3, 1, 2, 3])
  >>> y = torch.tensor([[1, 2], [3, 4]])
  >>> torch.tile(y, (2, 2))
  tensor([[1, 2, 1, 2],
          [3, 4, 3, 4],
          [1, 2, 1, 2],
          [3, 4, 3, 4]])
Conv3d
class torch.nn.Conv3d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', device=None, dtype=None)
Applies a 3D convolution over an input signal composed of several
   input planes.
In the simplest case, the output value of the layer with input size
   (N, C_{in}, D, H, W) and output (N, C_{out}, D_{out}, H_{out},
   W_{out}) can be precisely described as:
  out(N_i, C_{out_j}) = bias(C_{out_j}) +
  \sum_{k = 0}^{C_{in} - 1} weight(C_{out_j}, k) \star input(N_i,
  k)

where \star is the valid 3D cross-correlation operator
This module supports TensorFloat32.
On certain ROCm devices, when using float16 inputs this module will
   use different precision for backward.


"stride" controls the stride for the cross-correlation.


"padding" controls the amount of padding applied to the input. It
     can be either a string {'valid', 'same'} or a tuple of ints
giving the amount of implicit padding applied on both sides.


"dilation" controls the spacing between the kernel points; also
     known as the Ã  trous algorithm. It is harder to describe, but
     this link has a nice visualization of what "dilation" does.


"groups" controls the connections between inputs and outputs.
     "in_channels" and "out_channels" must both be divisible by
     "groups". For example,
* At groups=1, all inputs are convolved to all outputs.

* At groups=2, the operation becomes equivalent to having two
  conv layers side by side, each seeing half the input
  channels and producing half the output channels, and both
  subsequently concatenated.

* At groups= "in_channels", each input channel is convolved
  with its own set of filters (of size
  \frac{\text{out\_channels}}{\text{in\_channels}}).



The parameters "kernel_size", "stride", "padding", "dilation" can
   either be:
either be:
  * a single "int" -- in which case the same value is used for the
    depth, height and width dimension

  * a "tuple" of three ints -- in which case, the first *int* is
    used for the depth dimension, the second *int* for the height
    dimension and the third *int* for the width dimension

Note:
 When *groups == in_channels* and *out_channels == K *
 in_channels*, where *K* is a positive integer, this operation is
 also known as a "depthwise convolution".In other words, for an
 input of size (N, C_{in}, L_{in}), a depthwise convolution with a
 depthwise multiplier *K* can be performed with the arguments
 (C_\text{in}=C_\text{in}, C_\text{out}=C_\text{in} \times
 \text{K}, ..., \text{groups}=C_\text{in}).

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:
 "padding='valid'" is the same as no padding. "padding='same'"
 pads the input so the output has the shape as the input. However,
 this mode doesn't support any stride values other than 1.

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

Parameters:
      * in_channels (int) -- Number of channels in the input
        image
  * **out_channels** (*int*) -- Number of channels produced by the
    convolution

  * **kernel_size** (*int** or **tuple*) -- Size of the convolving
    kernel

  * **stride** (*int** or **tuple**, **optional*) -- Stride of the
    convolution. Default: 1

  * **padding** (*int**, **tuple** or **str**, **optional*) --
    Padding added to all six sides of the input. Default: 0
padding_mode (str, optional) -- "'zeros'",
        "'reflect'", "'replicate'" or "'circular'". Default: "'zeros'"


dilation (int or tuple, optional) -- Spacing
    between kernel elements. Default: 1


groups (int, optional) -- Number of blocked
    connections from input channels to output channels. Default: 1


bias (bool, optional) -- If "True", adds a learnable
    bias to the output. Default: "True"




Shape:
      * Input: (N, C_{in}, D_{in}, H_{in}, W_{in}) or (C_{in}, D_{in},
        H_{in}, W_{in})
  * Output: (N, C_{out}, D_{out}, H_{out}, W_{out}) or (C_{out},
    D_{out}, H_{out}, W_{out}), where

       D_{out} = \left\lfloor\frac{D_{in} + 2 \times
       \text{padding}[0] - \text{dilation}[0]       \times
       (\text{kernel\_size}[0] - 1) - 1}{\text{stride}[0]} +
       1\right\rfloor

       H_{out} = \left\lfloor\frac{H_{in} + 2 \times
\text{padding}[1] - \text{dilation}[1]       \times
           (\text{kernel_size}[1] - 1) - 1}{\text{stride}[1]} +
           1\right\rfloor
       W_{out} = \left\lfloor\frac{W_{in} + 2 \times
       \text{padding}[2] - \text{dilation}[2]       \times
       (\text{kernel\_size}[2] - 1) - 1}{\text{stride}[2]} +
       1\right\rfloor

Variables:
      * weight (Tensor) -- the learnable weights of the module
        of shape (\text{out_channels},
        \frac{\text{in_channels}}{\text{groups}},
        \text{kernel_size[0]}, \text{kernel_size[1]},
        \text{kernel_size[2]}). The values of these weights are
        sampled from \mathcal{U}(-\sqrt{k}, \sqrt{k}) where k =
        \frac{groups}{C_\text{in} *
        \prod_{i=0}^{2}\text{kernel_size}[i]}
  * **bias** (*Tensor*) -- the learnable bias of the module of
    shape (out_channels). If "bias" is "True", then the values of
    these weights are sampled from \mathcal{U}(-\sqrt{k},
\sqrt{k}) where k = \frac{groups}{C_\text{in} *
        \prod_{i=0}^{2}\text{kernel_size}[i]}
Examples:
  >>> # With square kernels and equal stride
  >>> m = nn.Conv3d(16, 33, 3, stride=2)
  >>> # non-square kernels and unequal stride and with padding
  >>> m = nn.Conv3d(16, 33, (3, 5, 2), stride=(2, 1, 1), padding=(4, 2, 0))
  >>> input = torch.randn(20, 16, 10, 50, 100)
  >>> output = m(input)
torch.Tensor.cuda
Tensor.cuda(device=None, non_blocking=False, memory_format=torch.preserve_format) -> Tensor
Returns a copy of this object in CUDA memory.
If this object is already in CUDA memory and on the correct device,
   then no copy is performed and the original object is returned.
Parameters:
      * device ("torch.device") -- The destination GPU device.
        Defaults to the current CUDA device.
  * **non_blocking** (*bool*) -- If "True" and the source is in
    pinned memory, the copy will be asynchronous with respect to
    the host. Otherwise, the argument has no effect. Default:
    "False".

  * **memory_format** ("torch.memory_format", optional) -- the
    desired memory format of returned Tensor. Default:
    "torch.preserve_format".
torch.randn_like
torch.randn_like(input, *, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor
Returns a tensor with the same size as "input" that is filled with
   random numbers from a normal distribution with mean 0 and variance
   1. "torch.randn_like(input)" is equivalent to
   "torch.randn(input.size(), dtype=input.dtype, layout=input.layout,
   device=input.device)".
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
torch.nn.functional.poisson_nll_loss
torch.nn.functional.poisson_nll_loss(input, target, log_input=True, full=False, size_average=None, eps=1e-08, reduce=None, reduction='mean')
Poisson negative log likelihood loss.
See "PoissonNLLLoss" for details.
Parameters:
      * input (Tensor) -- expectation of underlying Poisson
        distribution.
  * **target** (*Tensor*) -- random sample target \sim
    \text{Poisson}(input).

  * **log_input** (*bool*) -- if "True" the loss is computed as
    \exp(\text{input}) - \text{target} * \text{input}, if "False"
    then loss is \text{input} - \text{target} *
    \log(\text{input}+\text{eps}). Default: "True"

  * **full** (*bool*) -- whether to compute full loss, i. e. to
    add the Stirling approximation term. Default: "False"
    \text{target} * \log(\text{target}) - \text{target} + 0.5 *
    \log(2 * \pi * \text{target}).
\log(2 * \pi * \text{target}).
  * **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
    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"

  * **eps** (*float**, **optional*) -- Small value to avoid
    evaluation of \log(0) when "log_input"="False". Default: 1e-8

  * **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'"
Return type:
      Tensor
torch.max
torch.max(input) -> Tensor
Returns the maximum value of all elements in the "input" tensor.
Warning:
 This function produces deterministic (sub)gradients unlike
 "max(dim=0)"

Parameters:
      input (Tensor) -- the input tensor.
Example:
  >>> a = torch.randn(1, 3)
  >>> a
  tensor([[ 0.6763,  0.7445, -2.2369]])
  >>> torch.max(a)
  tensor(0.7445)

torch.max(input, dim, keepdim=False, *, out=None)
Returns a namedtuple "(values, indices)" where "values" is the
   maximum value of each row of the "input" tensor in the given
   dimension "dim". And "indices" is the index location of each
   maximum value found (argmax).
If "keepdim" is "True", the output tensors are of the same size as
   "input" except in the dimension "dim" where they are of size 1.
   Otherwise, "dim" is squeezed (see "torch.squeeze()"), resulting in
   the output tensors having 1 fewer dimension than "input".
Note:
Note:
 If there are multiple maximal values in a reduced row then the
 indices of the first maximal value are returned.

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

  * **keepdim** (*bool*) -- whether the output tensor has "dim"
    retained or not. Default: "False".

Keyword Arguments:
      out (tuple, optional) -- the result tuple of two
      output tensors (max, max_indices)
Example:
  >>> a = torch.randn(4, 4)
  >>> a
  tensor([[-1.2360, -0.2942, -0.1222,  0.8475],
          [ 1.1949, -1.1127, -2.2379, -0.6702],
          [ 1.5717, -0.9207,  0.1297, -1.8768],
          [-0.6172,  1.0036, -0.6060, -0.2432]])
  >>> torch.max(a, 1)
  torch.return_types.max(values=tensor([0.8475, 1.1949, 1.5717, 1.0036]), indices=tensor([3, 0, 0, 1]))

torch.max(input, other, *, out=None) -> Tensor
See "torch.maximum()".
torch.corrcoef
torch.corrcoef(input) -> Tensor
Estimates the Pearson product-moment correlation coefficient matrix
   of the variables given by the "input" matrix, where rows are the
   variables and columns are the observations.
Note:
 The correlation coefficient matrix R is computed using the
 covariance matrix C as given by R_{ij} = \frac{ C_{ij} } { \sqrt{
 C_{ii} * C_{jj} } }

Note:
 Due to floating point rounding, the resulting array may not be
 Hermitian and its diagonal elements may not be 1. The real and
 imaginary values are clipped to the interval [-1, 1] in an
 attempt to improve this situation.

Parameters:
      input (Tensor) -- A 2D matrix containing multiple
      variables and observations, or a Scalar or 1D vector
      representing a single variable.
Returns:
      (Tensor) The correlation coefficient matrix of the variables.
See also: "torch.cov()" covariance matrix.
Example:
Example:
  >>> x = torch.tensor([[0, 1, 2], [2, 1, 0]])
  >>> torch.corrcoef(x)
  tensor([[ 1., -1.],
          [-1.,  1.]])
  >>> x = torch.randn(2, 4)
  >>> x
  tensor([[-0.2678, -0.0908, -0.3766,  0.2780],
          [-0.5812,  0.1535,  0.2387,  0.2350]])
  >>> torch.corrcoef(x)
  tensor([[1.0000, 0.3582],
          [0.3582, 1.0000]])
  >>> torch.corrcoef(x[0])
  tensor(1.)
torch.bitwise_left_shift
torch.bitwise_left_shift(input, other, *, out=None) -> Tensor
Computes the left arithmetic shift of "input" by "other" bits. The
   input tensor must be of integral type. This operator supports
   broadcasting to a common shape and type promotion.
The operation applied is:
  \text{out}_i = \text{input}_i << \text{other}_i

Parameters:
      * input (Tensor or Scalar) -- the first input tensor
  * **other** (*Tensor** or **Scalar*) -- the second input tensor

Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Example:
  >>> torch.bitwise_left_shift(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8))
  tensor([-2, -2, 24], dtype=torch.int8)