shrinath-suresh/blogs-docs-splitted huggingface dataset:
determinism. When running identical inputs through the
        differentiation, the results must either match exactly
        (default, 0.0) or be within this tolerance.
  * **check_undefined_grad** (*bool**, **optional*) -- if True,
    check if undefined output grads are supported and treated as
    zeros, for "Tensor" outputs.

  * **check_batched_grad** (*bool**, **optional*) -- if True,
    check if we can compute batched gradients using prototype vmap
    support. Defaults to False.

  * **check_batched_forward_grad** (*bool**, **optional*) -- if
    True, checks if we can compute batched forward gradients using
    forward ad and prototype vmap support. Defaults to False.

  * **check_forward_ad** (*bool**, **optional*) -- if True, check
    that the gradients computed with forward mode AD match the
    numerical ones. Defaults to False.

  * **check_backward_ad** (*bool**, **optional*) -- if False, do
not perform any checks that rely on backward mode AD to be
        implemented. Defaults to True.
  * **fast_mode** (*bool**, **optional*) -- Fast mode for
    gradcheck and gradgradcheck is currently only implemented for
    R to R functions. If none of the inputs and outputs are
    complex a faster implementation of gradcheck that no longer
    computes the entire jacobian is run; otherwise, we fall back
    to the slow implementation.

Returns:
      True if all differences satisfy allclose condition
Return type:
      bool
MaxPool3d
class torch.nn.MaxPool3d(kernel_size, stride=None, padding=0, dilation=1, return_indices=False, ceil_mode=False)
Applies a 3D max pooling over an input signal composed of several
   input planes.
In the simplest case, the output value of the layer with input size
   (N, C, D, H, W), output (N, C, D_{out}, H_{out}, W_{out}) and
   "kernel_size" (kD, kH, kW) can be precisely described as:
  \begin{aligned}     \text{out}(N_i, C_j, d, h, w) ={} &
  \max_{k=0, \ldots, kD-1} \max_{m=0, \ldots, kH-1} \max_{n=0,
  \ldots, kW-1} \\                                       &
  \text{input}(N_i, C_j, \text{stride[0]} \times d + k,
  \text{stride[1]} \times h + m, \text{stride[2]} \times w + n)
  \end{aligned}

If "padding" is non-zero, then the input is implicitly padded with
   negative infinity on both sides for "padding" number of points.
   "dilation" controls the spacing between the kernel points. It is
harder to describe, but this link has a nice visualization of what
   "dilation" does.
Note:
 When ceil_mode=True, sliding windows are allowed to go off-bounds
 if they start within the left padding or the input. Sliding
 windows that would start in the right padded region are ignored.

The parameters "kernel_size", "stride", "padding", "dilation" can
   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

Parameters:
      * kernel_size (Union[int, Tuple[int, int,
        int]]) -- the size of the window to take a max over
  * **stride** (*Union**[**int**, **Tuple**[**int**, **int**,
    **int**]**]*) -- the stride of the window. Default value is
    "kernel_size"
"kernel_size"
  * **padding** (*Union**[**int**, **Tuple**[**int**, **int**,
    **int**]**]*) -- Implicit negative infinity padding to be
    added on all three sides

  * **dilation** (*Union**[**int**, **Tuple**[**int**, **int**,
    **int**]**]*) -- a parameter that controls the stride of
    elements in the window

  * **return_indices** (*bool*) -- if "True", will return the max
    indices along with the outputs. Useful for
    "torch.nn.MaxUnpool3d" later

  * **ceil_mode** (*bool*) -- when True, will use *ceil* instead
    of *floor* to compute the output shape

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} = \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

Examples:
  >>> # pool of square window of size=3, stride=2
  >>> m = nn.MaxPool3d(3, stride=2)
  >>> # pool of non-square window
  >>> m = nn.MaxPool3d((3, 2, 2), stride=(2, 1, 2))
  >>> input = torch.randn(20, 16, 50, 44, 31)
  >>> output = m(input)
torch.hspmm
torch.hspmm(mat1, mat2, *, out=None) -> Tensor
Performs a matrix multiplication of a sparse COO matrix "mat1" and
   a strided matrix "mat2". The result is a (1 + 1)-dimensional hybrid
   COO matrix.
Parameters:
      * mat1 (Tensor) -- the first sparse matrix to be matrix
        multiplied
  * **mat2** (*Tensor*) -- the second strided matrix to be matrix
    multiplied

Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
torch.sparse.sampled_addmm
torch.sparse.sampled_addmm(input, mat1, mat2, *, beta=1., alpha=1., out=None) -> Tensor
Performs a matrix multiplication of the dense matrices "mat1" and
   "mat2" at the locations specified by the sparsity pattern of
   "input". The matrix "input" is added to the final result.
Mathematically this performs the following operation:
  \text{out} = \alpha\ (\text{mat1} \mathbin{@}
  \text{mat2})*\text{spy}(\text{input}) + \beta\ \text{input}

where \text{spy}(\text{input}) is the sparsity pattern matrix of
   "input", "alpha" and "beta" are the scaling factors.
   \text{spy}(\text{input}) has value 1 at the positions where "input"
   has non-zero values, and 0 elsewhere.
Note:
 "input" must be a sparse CSR tensor. "mat1" and "mat2" must be
 dense tensors.

Parameters:
      * input (Tensor) -- a sparse CSR matrix of shape (m, n)
        to be added and used to compute the sampled matrix
        multiplication
multiplication
  * **mat1** (*Tensor*) -- a dense matrix of shape *(m, k)* to be
    multiplied

  * **mat2** (*Tensor*) -- a dense matrix of shape *(k, n)* to be
    multiplied

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

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

Examples:
  >>> input = torch.eye(3, device='cuda').to_sparse_csr()
  >>> mat1 = torch.randn(3, 5, device='cuda')
  >>> mat2 = torch.randn(5, 3, device='cuda')
  >>> torch.sparse.sampled_addmm(input, mat1, mat2)
  tensor(crow_indices=tensor([0, 1, 2, 3]),
      col_indices=tensor([0, 1, 2]),
      values=tensor([ 0.2847, -0.7805, -0.1900]), device='cuda:0',
      size=(3, 3), nnz=3, layout=torch.sparse_csr)
  >>> torch.sparse.sampled_addmm(input, mat1, mat2).to_dense()
tensor([[ 0.2847,  0.0000,  0.0000],
          [ 0.0000, -0.7805,  0.0000],
          [ 0.0000,  0.0000, -0.1900]], device='cuda:0')
      >>> torch.sparse.sampled_addmm(input, mat1, mat2, beta=0.5, alpha=0.5)
      tensor(crow_indices=tensor([0, 1, 2, 3]),
          col_indices=tensor([0, 1, 2]),
          values=tensor([ 0.1423, -0.3903, -0.0950]), device='cuda:0',
          size=(3, 3), nnz=3, layout=torch.sparse_csr)
torch.take
torch.take(input, index) -> Tensor
Returns a new tensor with the elements of "input" at the given
   indices. The input tensor is treated as if it were viewed as a 1-D
   tensor. The result takes the same shape as the indices.
Parameters:
      * input (Tensor) -- the input tensor.
  * **index** (*LongTensor*) -- the indices into tensor

Example:
  >>> src = torch.tensor([[4, 3, 5],
  ...                     [6, 7, 8]])
  >>> torch.take(src, torch.tensor([0, 2, 5]))
  tensor([ 4,  5,  8])
torch.vander
torch.vander(x, N=None, increasing=False) -> Tensor
Generates a Vandermonde matrix.
The columns of the output matrix are elementwise powers of the
   input vector x^{(N-1)}, x^{(N-2)}, ..., x^0. If increasing is True,
   the order of the columns is reversed x^0, x^1, ..., x^{(N-1)}. Such
   a matrix with a geometric progression in each row is named for
   Alexandre-Theophile Vandermonde.
Parameters:
      * x (Tensor) -- 1-D input tensor.
  * **N** (*int**, **optional*) -- Number of columns in the
    output. If N is not specified, a square array is returned (N =
    len(x)).

  * **increasing** (*bool**, **optional*) -- Order of the powers
    of the columns. If True, the powers increase from left to
    right, if False (the default) they are reversed.

Returns:
      Vandermonde matrix. If increasing is False, the first column is
      x^{(N-1)}, the second x^{(N-2)} and so forth. If increasing is
True, the columns are x^0, x^1, ..., x^{(N-1)}.
Return type:
      Tensor
Example:
  >>> x = torch.tensor([1, 2, 3, 5])
  >>> torch.vander(x)
  tensor([[  1,   1,   1,   1],
          [  8,   4,   2,   1],
          [ 27,   9,   3,   1],
          [125,  25,   5,   1]])
  >>> torch.vander(x, N=3)
  tensor([[ 1,  1,  1],
          [ 4,  2,  1],
          [ 9,  3,  1],
          [25,  5,  1]])
  >>> torch.vander(x, N=3, increasing=True)
  tensor([[ 1,  1,  1],
          [ 1,  2,  4],
          [ 1,  3,  9],
          [ 1,  5, 25]])
NLLLoss
class torch.nn.NLLLoss(weight=None, size_average=None, ignore_index=- 100, reduce=None, reduction='mean')
The negative log likelihood loss. It is useful to train a
   classification problem with C classes.
If provided, the optional argument "weight" should be a 1D Tensor
   assigning weight to each of the classes. This is particularly
   useful when you have an unbalanced training set.
The input given through a forward call is expected to contain
   log-probabilities of each class. input has to be a Tensor of size
   either (minibatch, C) or (minibatch, C, d_1, d_2, ..., d_K) with K
   \geq 1 for the K-dimensional case. The latter is useful for
   higher dimension inputs, such as computing NLL loss per-pixel for
   2D images.
Obtaining log-probabilities in a neural network is easily achieved
   by adding a  LogSoftmax  layer in the last layer of your network.
   You may use CrossEntropyLoss instead, if you prefer not to add an
   extra layer.
extra layer.
The target that this loss expects should be a class index in the
   range [0, C-1] where C = number of classes; if ignore_index is
   specified, this loss also accepts this class index (this index may
   not necessarily be in the class range).
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 = - w_{y_n}
  x_{n,y_n}, \quad w_{c} = \text{weight}[c] \cdot \mathbb{1}\{c
  \not= \text{ignore\_index}\},

where x is the input, y is the target, w is the weight, and N is
   the batch size. If "reduction" is not "'none'" (default "'mean'"),
   then
  \ell(x, y) = \begin{cases}     \sum_{n=1}^N
  \frac{1}{\sum_{n=1}^N w_{y_n}} l_n, &     \text{if reduction} =
  \text{`mean';}\\     \sum_{n=1}^N l_n,  &     \text{if
  reduction} = \text{`sum'.} \end{cases}

Parameters:
      * weight (Tensor, optional) -- a manual rescaling
weight given to each class. If given, it has to be a Tensor of
        size C. Otherwise, it is treated as if having all ones.
  * **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: "None"

  * **ignore_index** (*int**, **optional*) -- Specifies a target
    value that is ignored and does not contribute to the input
    gradient. When "size_average" is "True", the loss is averaged
    over non-ignored targets.

  * **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:
        "None"
  * **reduction** (*str**, **optional*) -- Specifies the reduction
    to apply to the output: "'none'" | "'mean'" | "'sum'".
    "'none'": no reduction will be applied, "'mean'": the weighted
    mean of the output is taken, "'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: (N, C) or (C), where C = number of classes, or (N, C,
        d_1, d_2, ..., d_K) with K \geq 1 in the case of
        K-dimensional loss.
  * Target: (N) or (), where each value is 0 \leq
    \text{targets}[i] \leq C-1, or (N, d_1, d_2, ..., d_K) with K
    \geq 1 in the case of K-dimensional loss.
\geq 1 in the case of K-dimensional loss.
  * Output: If "reduction" is "'none'", shape (N) or (N, d_1, d_2,
    ..., d_K) with K \geq 1 in the case of K-dimensional loss.
    Otherwise, scalar.

Examples:
  >>> m = nn.LogSoftmax(dim=1)
  >>> loss = nn.NLLLoss()
  >>> # input is of size N x C = 3 x 5
  >>> input = torch.randn(3, 5, requires_grad=True)
  >>> # each element in target has to have 0 <= value < C
  >>> target = torch.tensor([1, 0, 4])
  >>> output = loss(m(input), target)
  >>> output.backward()
  >>>
  >>>
  >>> # 2D loss example (used, for example, with image inputs)
  >>> N, C = 5, 4
  >>> loss = nn.NLLLoss()
  >>> # input is of size N x C x height x width
  >>> data = torch.randn(N, 16, 10, 10)
  >>> conv = nn.Conv2d(16, C, (3, 3))
  >>> m = nn.LogSoftmax(dim=1)
  >>> # each element in target has to have 0 <= value < C
  >>> target = torch.empty(N, 8, 8, dtype=torch.long).random_(0, C)
CUDAPluggableAllocator
class torch.cuda.CUDAPluggableAllocator(path_to_so_file, alloc_fn_name, free_fn_name)
CUDA memory allocator loaded from a so file.
Memory allocators are compiled in .so files and loaded dynamically
   using ctypes. To change the active allocator use the
   "torch.memory.cuda.change_current_allocator()" function.
Parameters:
      * path_to_so_file (str) -- Path in the filesystem to the
        .so file containing the allocator functions
  * **alloc_fn_name** (*str*) -- Name of the function to perform
    the memory allocation in the so file. The signature must be:
    void* alloc_fn_name(ssize_t size, int device, cudaStream_t
    stream);

  * **free_fn_name** (*str*) -- Name of the function to perform
    the memory release in the so file. The signature must be: void
    free_fn_name(void* ptr, size_t size, cudaStream_t stream);

Warning:
 This is currently supported only in unix OSs

Note:
torch.set_deterministic_debug_mode
torch.set_deterministic_debug_mode(debug_mode)
Sets the debug mode for deterministic operations.
Note:
 This is an alternative interface for
 "torch.use_deterministic_algorithms()". Refer to that function's
 documentation for details about affected operations.

Parameters:
      debug_mode (str or int) -- If "default" or 0, don't
      error or warn on nondeterministic operations. If "warn" or 1,
      warn on nondeterministic operations. If "error" or 2, error on
      nondeterministic operations.
ReLU6
class torch.ao.nn.quantized.ReLU6(inplace=False)
Applies the element-wise function:
\text{ReLU6}(x) = \min(\max(x_0, x), q(6)), where x_0 is the
   zero_point, and q(6) is the quantized representation of number 6.
Parameters:
      inplace (bool) -- can optionally do the operation in-
      place. Default: "False"
Shape:
      * Input: (N, *) where *** means, any number of additional
        dimensions
  * Output: (N, *), same shape as the input

[image]
Examples:
  >>> m = nn.quantized.ReLU6()
  >>> input = torch.randn(2)
  >>> input = torch.quantize_per_tensor(input, 1.0, 0, dtype=torch.qint32)
  >>> output = m(input)
torch.cumsum
torch.cumsum(input, dim, *, dtype=None, out=None) -> Tensor
Returns the cumulative sum of elements of "input" in the dimension
   "dim".
For example, if "input" is a vector of size N, the result will also
   be a vector of size N, with elements.
  y_i = x_1 + x_2 + x_3 + \dots + x_i

Parameters:
      * input (Tensor) -- the input tensor.
  * **dim** (*int*) -- the dimension to do the operation over

Keyword Arguments:
      * dtype ("torch.dtype", optional) -- the desired data type
        of returned tensor. If specified, the input tensor is casted
        to "dtype" before the operation is performed. This is useful
        for preventing data type overflows. Default: None.
  * **out** (*Tensor**, **optional*) -- the output tensor.

Example:
  >>> a = torch.randn(10)
  >>> a
  tensor([-0.8286, -0.4890,  0.5155,  0.8443,  0.1865, -0.1752, -2.0595,
           0.1850, -1.1571, -0.4243])
  >>> torch.cumsum(a, dim=0)
torch.autograd.graph.Node.name
abstract Node.name()
Returns the name.
Example:
  >>> import torch
  >>> a = torch.tensor([0., 0., 0.], requires_grad=True)
  >>> b = a.clone()
  >>> assert isinstance(b.grad_fn, torch.autograd.graph.Node)
  >>> print(b.grad_fn.name())
  CloneBackward0

Return type:
      str
set_multithreading_enabled
class torch.autograd.set_multithreading_enabled(mode)
Context-manager that sets multithreaded backwards on or off.
"set_multithreading_enabled" will enable or disable multithreaded
   backwards based on its argument "mode". It can be used as a
   context-manager or as a function.
This context manager is thread local; it will not affect
   computation in other threads.
Parameters:
      mode (bool) -- Flag whether to enable multithreaded
      backwards ("True"), or disable ("False").
Note:
 This API does not apply to forward-mode AD.
torch.signal.windows.gaussian
torch.signal.windows.gaussian(M, *, std=1.0, sym=True, dtype=None, layout=torch.strided, device=None, requires_grad=False)
Computes a window with a gaussian waveform.
The gaussian window is defined as follows:
  w_n = \exp{\left(-\left(\frac{n}{2\sigma}\right)^2\right)}

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:
      * std (float, optional) -- the standard deviation of
        the gaussian. It controls how narrow or wide the window is.
        Default: 1.0.
  * **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 gaussian window with a standard deviation of 1.0.
  >>> torch.signal.windows.gaussian(10)
torch.signal.windows.gaussian(10)
      tensor([4.0065e-05, 2.1875e-03, 4.3937e-02, 3.2465e-01, 8.8250e-01, 8.8250e-01, 3.2465e-01, 4.3937e-02, 2.1875e-03, 4.0065e-05])



  >>> # Generates a periodic gaussian window and standard deviation equal to 0.9.
  >>> torch.signal.windows.gaussian(10, sym=False,std=0.9)
  tensor([1.9858e-07, 5.1365e-05, 3.8659e-03, 8.4658e-02, 5.3941e-01, 1.0000e+00, 5.3941e-01, 8.4658e-02, 3.8659e-03, 5.1365e-05])
torch.linalg.lu_factor
torch.linalg.lu_factor(A, *, bool pivot=True, out=None) -> (Tensor, Tensor)
Computes a compact representation of the LU factorization with
   partial pivoting of a matrix.
This function computes a compact representation of the
   decomposition given by "torch.linalg.lu()". If the matrix is
   square, this representation may be used in
   "torch.linalg.lu_solve()" to solve system of linear equations that
   share the matrix "A".
The returned decomposition is represented as a named tuple (LU,
   pivots). The "LU" matrix has the same shape as the input matrix
   "A". Its upper and lower triangular parts encode the non-constant
   elements of "L" and "U" of the LU decomposition of "A".
The returned permutation matrix is represented by a 1-indexed
   vector. pivots[i] == j represents that in the i-th step of the
   algorithm, the i-th row was permuted with the j-1-th row.
On CUDA, one may use "pivot"= False. In this case, this function
returns the LU decomposition without pivoting if it exists.
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.
Note:
 When inputs are on a CUDA device, this function synchronizes that
 device with the CPU. For a version of this function that does not
 synchronize, see "torch.linalg.lu_factor_ex()".

Warning:
 The LU decomposition is almost never unique, as often there are
 different permutation matrices that can yield different LU
 decompositions. As such, different platforms, like SciPy, or
 inputs on different devices, may produce different valid
 decompositions.Gradient computations are only supported if the
 input matrix is full-rank. If this condition is not met, no error
 will be thrown, but the gradient may not be finite. This is
 because the LU decomposition with pivoting is not differentiable
at these points.
See also:
 "torch.linalg.lu_solve()" solves a system of linear equations
 given the output of this function provided the input matrix was
 square and invertible.

 "torch.lu_unpack()" unpacks the tensors returned by "lu_factor()"
 into the three matrices *P, L, U* that form the decomposition.

 "torch.linalg.lu()" computes the LU decomposition with partial
 pivoting of a possibly non-square matrix. It is a composition of
 "lu_factor()" and "torch.lu_unpack()".

 "torch.linalg.solve()" solves a system of linear equations. It is
 a composition of "lu_factor()" and "lu_solve()".

Parameters:
      A (Tensor) -- tensor of shape (, m, n)* where *** is
      zero or more batch dimensions.
Keyword Arguments:
      * pivot (bool, optional) -- Whether to compute the LU
        decomposition with partial pivoting, or the regular LU
        decomposition. "pivot"= False not supported on CPU. Default:
        True.
True.
  * **out** (*tuple**, **optional*) -- tuple of two tensors to
    write the output to. Ignored if *None*. Default: *None*.

Returns:
      A named tuple (LU, pivots).
Raises:
      RuntimeError -- if the "A" matrix is not invertible or any
      matrix in a batched "A"     is not invertible.
Examples:
  >>> A = torch.randn(2, 3, 3)
  >>> B1 = torch.randn(2, 3, 4)
  >>> B2 = torch.randn(2, 3, 7)
  >>> A_factor = torch.linalg.lu_factor(A)
  >>> X1 = torch.linalg.lu_solve(A_factor, B1)
  >>> X2 = torch.linalg.lu_solve(A_factor, B2)
  >>> torch.allclose(A @ X1, B1)
  True
  >>> torch.allclose(A @ X2, B2)
  True