shrinath-suresh/blogs-docs-splitted huggingface dataset:
torch.logical_not
torch.logical_not(input, *, out=None) -> Tensor
Computes the element-wise logical NOT of the given input tensor. If
   not specified, the output tensor will have the bool dtype. If the
   input tensor is not a bool tensor, zeros are treated as "False" and
   non-zeros are treated as "True".
Parameters:
      input (Tensor) -- the input tensor.
Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Example:
  >>> torch.logical_not(torch.tensor([True, False]))
  tensor([False,  True])
  >>> torch.logical_not(torch.tensor([0, 1, -10], dtype=torch.int8))
  tensor([ True, False, False])
  >>> torch.logical_not(torch.tensor([0., 1.5, -10.], dtype=torch.double))
  tensor([ True, False, False])
  >>> torch.logical_not(torch.tensor([0., 1., -10.], dtype=torch.double), out=torch.empty(3, dtype=torch.int16))
  tensor([1, 0, 0], dtype=torch.int16)
LazyConvTranspose3d
class torch.nn.LazyConvTranspose3d(out_channels, kernel_size, stride=1, padding=0, output_padding=0, groups=1, bias=True, dilation=1, padding_mode='zeros', device=None, dtype=None)
A "torch.nn.ConvTranspose3d" module with lazy initialization of the
   "in_channels" argument of the "ConvTranspose3d" that is inferred
   from the "input.size(1)". The attributes that will be lazily
   initialized are weight and bias.
Check the "torch.nn.modules.lazy.LazyModuleMixin" for further
   documentation on lazy modules and their limitations.
Parameters:
      * 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** or **tuple**, **optional*) -- "dilation *
    (kernel_size - 1) - padding" zero-padding will be added to
both sides of each dimension in the input. Default: 0
  * **output_padding** (*int** or **tuple**, **optional*) --
    Additional size added to one side of each dimension in the
    output shape. Default: 0

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

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

See also:
 "torch.nn.ConvTranspose3d" and
 "torch.nn.modules.lazy.LazyModuleMixin"

cls_to_become
  alias of "ConvTranspose3d"
torch.cuda.reset_max_memory_allocated
torch.cuda.reset_max_memory_allocated(device=None)
Resets the starting point in tracking maximum GPU memory occupied
   by tensors for a given device.
See "max_memory_allocated()" for details.
Parameters:
      device (torch.device or int, optional) -- selected
      device. Returns statistic for the current device, given by
      "current_device()", if "device" is "None" (default).
Warning:
 This function now calls "reset_peak_memory_stats()", which resets
 /all/ peak memory stats.

Note:
 See Memory management for more details about GPU memory
 management.
PruningContainer
class torch.nn.utils.prune.PruningContainer(*args)
Container holding a sequence of pruning methods for iterative
   pruning. Keeps track of the order in which pruning methods are
   applied and handles combining successive pruning calls.
Accepts as argument an instance of a BasePruningMethod or an
   iterable of them.
add_pruning_method(method)
  Adds a child pruning "method" to the container.

  Parameters:
     **method** (*subclass of BasePruningMethod*) -- child pruning
     method to be added to the container.

classmethod apply(module, name, args, importance_scores=None, *kwargs)
  Adds the forward pre-hook that enables pruning on the fly and
  the reparametrization of a tensor in terms of the original
  tensor and the pruning mask.

  Parameters:
     * **module** (*nn.Module*) -- module containing the tensor to
       prune

     * **name** (*str*) -- parameter name within "module" on which
pruning will act.
     * **args** -- arguments passed on to a subclass of
       "BasePruningMethod"

     * **importance_scores** (*torch.Tensor*) -- tensor of
       importance scores (of same shape as module parameter) used
       to compute mask for pruning. The values in this tensor
       indicate the importance of the corresponding elements in
       the parameter being pruned. If unspecified or None, the
       parameter will be used in its place.

     * **kwargs** -- keyword arguments passed on to a subclass of
       a "BasePruningMethod"

apply_mask(module)
  Simply handles the multiplication between the parameter being
  pruned and the generated mask. Fetches the mask and the original
  tensor from the module and returns the pruned version of the
  tensor.

  Parameters:
     **module** (*nn.Module*) -- module containing the tensor to
     prune

  Returns:
     pruned version of the input tensor
pruned version of the input tensor
  Return type:
     pruned_tensor (torch.Tensor)

compute_mask(t, default_mask)
  Applies the latest "method" by computing the new partial masks
  and returning its combination with the "default_mask". The new
  partial mask should be computed on the entries or channels that
  were not zeroed out by the "default_mask". Which portions of the
  tensor "t" the new mask will be calculated from depends on the
  "PRUNING_TYPE" (handled by the type handler):

  * for 'unstructured', the mask will be computed from the raveled
    list of nonmasked entries;

  * for 'structured', the mask will be computed from the nonmasked
    channels in the tensor;

  * for 'global', the mask will be computed across all entries.

  Parameters:
     * **t** (*torch.Tensor*) -- tensor representing the parameter
       to prune (of same dimensions as "default_mask").
default_mask (torch.Tensor) -- mask from previous
           pruning iteration.
Returns:
     new mask that combines the effects of the "default_mask" and
     the new mask from the current pruning "method" (of same
     dimensions as "default_mask" and "t").
Return type:
     mask (torch.Tensor)


prune(t, default_mask=None, importance_scores=None)
  Computes and returns a pruned version of input tensor "t"
  according to the pruning rule specified in "compute_mask()".

  Parameters:
     * **t** (*torch.Tensor*) -- tensor to prune (of same
       dimensions as "default_mask").

     * **importance_scores** (*torch.Tensor*) -- tensor of
       importance scores (of same shape as "t") used to compute
       mask for pruning "t". The values in this tensor indicate
       the importance of the corresponding elements in the "t"
       that is being pruned. If unspecified or None, the tensor
"t" will be used in its place.
     * **default_mask** (*torch.Tensor**, **optional*) -- mask
       from previous pruning iteration, if any. To be considered
       when determining what portion of the tensor that pruning
       should act on. If None, default to a mask of ones.

  Returns:
     pruned version of tensor "t".

remove(module)
  Removes the pruning reparameterization from a module. The pruned
  parameter named "name" remains permanently pruned, and the
  parameter named "name+'_orig'" is removed from the parameter
  list. Similarly, the buffer named "name+'_mask'" is removed from
  the buffers.

  Note:

    Pruning itself is NOT undone or reversed!
torch.permute
torch.permute(input, dims) -> Tensor
Returns a view of the original tensor "input" with its dimensions
   permuted.
Parameters:
      * input (Tensor) -- the input tensor.
  * **dims** (*tuple of python:int*) -- The desired ordering of
    dimensions

-[ Example ]-



x = torch.randn(2, 3, 5)
x.size()
   torch.Size([2, 3, 5])
torch.permute(x, (2, 0, 1)).size()
   torch.Size([5, 2, 3])
torch.movedim
torch.movedim(input, source, destination) -> Tensor
Moves the dimension(s) of "input" at the position(s) in "source" to
   the position(s) in "destination".
Other dimensions of "input" that are not explicitly moved remain in
   their original order and appear at the positions not specified in
   "destination".
Parameters:
      * input (Tensor) -- the input tensor.
  * **source** (*int** or **tuple of ints*) -- Original positions
    of the dims to move. These must be unique.

  * **destination** (*int** or **tuple of ints*) -- Destination
    positions for each of the original dims. These must also be
    unique.

Examples:
  >>> t = torch.randn(3,2,1)
  >>> t
  tensor([[[-0.3362],
          [-0.8437]],

          [[-0.9627],
          [ 0.1727]],

          [[ 0.5173],
          [-0.1398]]])
  >>> torch.movedim(t, 1, 0).shape
  torch.Size([2, 3, 1])
  >>> torch.movedim(t, 1, 0)
torch.movedim(t, 1, 0)
      tensor([[[-0.3362],
              [-0.9627],
              [ 0.5173]],



          [[-0.8437],
          [ 0.1727],
          [-0.1398]]])
  >>> torch.movedim(t, (1, 2), (0, 1)).shape
  torch.Size([2, 1, 3])
  >>> torch.movedim(t, (1, 2), (0, 1))
  tensor([[[-0.3362, -0.9627,  0.5173]],

          [[-0.8437,  0.1727, -0.1398]]])
CustomFromMask
class torch.nn.utils.prune.CustomFromMask(mask)
classmethod apply(module, name, mask)
  Adds the forward pre-hook that enables pruning on the fly and
  the reparametrization of a tensor in terms of the original
  tensor and the pruning mask.

  Parameters:
     * **module** (*nn.Module*) -- module containing the tensor to
       prune

     * **name** (*str*) -- parameter name within "module" on which
       pruning will act.

apply_mask(module)
  Simply handles the multiplication between the parameter being
  pruned and the generated mask. Fetches the mask and the original
  tensor from the module and returns the pruned version of the
  tensor.

  Parameters:
     **module** (*nn.Module*) -- module containing the tensor to
     prune

  Returns:
     pruned version of the input tensor

  Return type:
     pruned_tensor (torch.Tensor)

prune(t, default_mask=None, importance_scores=None)
Computes and returns a pruned version of input tensor "t"
      according to the pruning rule specified in "compute_mask()".
  Parameters:
     * **t** (*torch.Tensor*) -- tensor to prune (of same
       dimensions as "default_mask").

     * **importance_scores** (*torch.Tensor*) -- tensor of
       importance scores (of same shape as "t") used to compute
       mask for pruning "t". The values in this tensor indicate
       the importance of the corresponding elements in the "t"
       that is being pruned. If unspecified or None, the tensor
       "t" will be used in its place.

     * **default_mask** (*torch.Tensor**, **optional*) -- mask
       from previous pruning iteration, if any. To be considered
       when determining what portion of the tensor that pruning
       should act on. If None, default to a mask of ones.

  Returns:
     pruned version of tensor "t".

remove(module)
torch.linalg.eigvalsh
torch.linalg.eigvalsh(A, UPLO='L', *, out=None) -> Tensor
Computes the eigenvalues of a complex Hermitian or real symmetric
   matrix.
Letting \mathbb{K} be \mathbb{R} or \mathbb{C}, the eigenvalues
   of a complex Hermitian or real symmetric  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{R}}

where \mathrm{I}_n is the n-dimensional identity matrix. The
   eigenvalues of a real symmetric or complex Hermitian matrix are
   always real.
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.
The eigenvalues are returned in ascending order.
"A" is assumed to be Hermitian (resp. symmetric), but this is not
checked internally, instead:


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


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


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

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

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

Keyword Arguments:
      out (Tensor, optional) -- output tensor. Ignored if
      None. Default: None.
Returns:
      A real-valued tensor containing the eigenvalues even when "A" is
complex. The eigenvalues are returned in ascending order.
Examples:
  >>> A = torch.randn(2, 2, dtype=torch.complex128)
  >>> A = A + A.T.conj()  # creates a Hermitian matrix
  >>> A
  tensor([[2.9228+0.0000j, 0.2029-0.0862j],
          [0.2029+0.0862j, 0.3464+0.0000j]], dtype=torch.complex128)
  >>> torch.linalg.eigvalsh(A)
  tensor([0.3277, 2.9415], dtype=torch.float64)

  >>> A = torch.randn(3, 2, 2, dtype=torch.float64)
  >>> A = A + A.mT  # creates a batch of symmetric matrices
  >>> torch.linalg.eigvalsh(A)
  tensor([[ 2.5797,  3.4629],
          [-4.1605,  1.3780],
          [-3.1113,  2.7381]], dtype=torch.float64)
torch.nn.functional.adaptive_max_pool3d
torch.nn.functional.adaptive_max_pool3d(args, *kwargs)
Applies a 3D adaptive max pooling over an input signal composed of
   several input planes.
See "AdaptiveMaxPool3d" for details and output shape.
Parameters:
      * output_size -- the target output size (single integer or
        triple-integer tuple)
  * **return_indices** -- whether to return pooling indices.
    Default: "False"
torch.mv
torch.mv(input, vec, *, out=None) -> Tensor
Performs a matrix-vector product of the matrix "input" and the
   vector "vec".
If "input" is a (n \times m) tensor, "vec" is a 1-D tensor of size
   m, "out" will be 1-D of size n.
Note:
 This function does not broadcast.

Parameters:
      * input (Tensor) -- matrix to be multiplied
  * **vec** (*Tensor*) -- vector to be multiplied

Keyword Arguments:
      out (Tensor, optional) -- the output tensor.
Example:
  >>> mat = torch.randn(2, 3)
  >>> vec = torch.randn(3)
  >>> torch.mv(mat, vec)
  tensor([ 1.0404, -0.6361])
default_qat_qconfig
torch.quantization.qconfig.default_qat_qconfig
alias of QConfig(activation=functools.partial(,
   observer=,
   quant_min=0, quant_max=255, dtype=torch.quint8,
   qscheme=torch.per_tensor_affine, reduce_range=True){},
   weight=functools.partial(,
   observer=,
   quant_min=-128, quant_max=127, dtype=torch.qint8,
   qscheme=torch.per_tensor_symmetric, reduce_range=False){})
torch.Tensor.set_
Tensor.set_(source=None, storage_offset=0, size=None, stride=None) -> Tensor
Sets the underlying storage, size, and strides. If "source" is a
   tensor, "self" tensor will share the same storage and have the same
   size and strides as "source". Changes to elements in one tensor
   will be reflected in the other.
If "source" is a "Storage", the method sets the underlying storage,
   offset, size, and stride.
Parameters:
      * source (Tensor or Storage) -- the tensor or storage
        to use
  * **storage_offset** (*int**, **optional*) -- the offset in the
    storage

  * **size** (*torch.Size**, **optional*) -- the desired size.
    Defaults to the size of the source.

  * **stride** (*tuple**, **optional*) -- the desired stride.
    Defaults to C-contiguous strides.
torch.amax
torch.amax(input, dim, keepdim=False, *, out=None) -> Tensor
Returns the maximum 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.8177,  1.4878, -0.2491,  0.9130],
          [-0.7158,  1.1775,  2.0992,  0.4817],
          [-0.0053,  0.0164, -1.3738, -0.0507],
          [ 1.9700,  1.1106, -1.0318, -1.0816]])
  >>> torch.amax(a, 1)
  tensor([1.4878, 2.0992, 0.0164, 1.9700])
torch.cuda.manual_seed
torch.cuda.manual_seed(seed)
Sets the seed for generating random numbers for the current GPU.
   It's safe to call this function if CUDA is not available; in that
   case, it is silently ignored.
Parameters:
      seed (int) -- The desired seed.
Warning:
 If you are working with a multi-GPU model, this function is
 insufficient to get determinism.  To seed all GPUs, use
 "manual_seed_all()".
torch.lobpcg
torch.lobpcg(A, k=None, B=None, X=None, n=None, iK=None, niter=None, tol=None, largest=None, method=None, tracker=None, ortho_iparams=None, ortho_fparams=None, ortho_bparams=None)
Find the k largest (or smallest) eigenvalues and the corresponding
   eigenvectors of a symmetric positive definite generalized
   eigenvalue problem using matrix-free LOBPCG methods.
This function is a front-end to the following LOBPCG algorithms
   selectable via method argument:
  *method="basic"* - the LOBPCG method introduced by Andrew
  Knyazev, see [Knyazev2001]. A less robust method, may fail when
  Cholesky is applied to singular input.

  *method="ortho"* - the LOBPCG method with orthogonal basis
  selection [StathopoulosEtal2002]. A robust method.

Supported inputs are dense, sparse, and batches of dense matrices.
Note:
 In general, the basic method spends least time per iteration.
 However, the robust methods converge much faster and are more
stable. So, the usage of the basic method is generally not
     recommended but there exist cases where the usage of the basic
     method may be preferred.
Warning:
 The backward method does not support sparse and complex inputs.
 It works only when *B* is not provided (i.e. *B == None*). We are
 actively working on extensions, and the details of the algorithms
 are going to be published promptly.

Warning:
 While it is assumed that *A* is symmetric, *A.grad* is not. To
 make sure that *A.grad* is symmetric, so that *A - t * A.grad* is
 symmetric in first-order optimization routines, prior to running
 *lobpcg* we do the following symmetrization map: *A -> (A +
 A.t()) / 2*. The map is performed only when the *A* requires
 gradients.

Parameters:
      * A (Tensor) -- the input tensor of size (*, m, m)
  * **B** (*Tensor**, **optional*) -- the input tensor of size (*,
    m, m). When not specified, *B* is interpreted as identity
matrix.
  * **X** (*tensor**, **optional*) -- the input tensor of size (*,
    m, n) where *k <= n <= m*. When specified, it is used as
    initial approximation of eigenvectors. X must be a dense
    tensor.

  * **iK** (*tensor**, **optional*) -- the input tensor of size
    (*, m, m). When specified, it will be used as preconditioner.

  * **k** (*integer**, **optional*) -- the number of requested
    eigenpairs. Default is the number of X columns (when
    specified) or *1*.

  * **n** (*integer**, **optional*) -- if X is not specified then
    *n* specifies the size of the generated random approximation
    of eigenvectors. Default value for *n* is *k*. If X is
    specified, the value of *n* (when specified) must be the
    number of X columns.

  * **tol** (*float**, **optional*) -- residual tolerance for
    stopping criterion. Default is *feps ** 0.5* where *feps* is
smallest non-zero floating-point number of the given input
        tensor A data type.
  * **largest** (*bool**, **optional*) -- when True, solve the
    eigenproblem for the largest eigenvalues. Otherwise, solve the
    eigenproblem for smallest eigenvalues. Default is *True*.

  * **method** (*str**, **optional*) -- select LOBPCG method. See
    the description of the function above. Default is "ortho".

  * **niter** (*int**, **optional*) -- maximum number of
    iterations. When reached, the iteration process is hard-
    stopped and the current approximation of eigenpairs is
    returned. For infinite iteration but until convergence
    criteria is met, use *-1*.

  * **tracker** (*callable**, **optional*) --

    a function for tracing the iteration process. When specified,
    it is called at each iteration step with LOBPCG instance as an
    argument. The LOBPCG instance holds the full state of the
iteration process in the following attributes:
       *iparams*, *fparams*, *bparams* - dictionaries of integer,
       float, and boolean valued input parameters, respectively

       *ivars*, *fvars*, *bvars*, *tvars* - dictionaries of
       integer, float, boolean, and Tensor valued iteration
       variables, respectively.

       *A*, *B*, *iK* - input Tensor arguments.

       *E*, *X*, *S*, *R* - iteration Tensor variables.

    For instance:

       *ivars["istep"]* - the current iteration step *X* - the
       current approximation of eigenvectors *E* - the current
       approximation of eigenvalues *R* - the current residual
       *ivars["converged_count"]* - the current number of
       converged eigenpairs *tvars["rerr"]* - the current state of
       convergence criteria

    Note that when *tracker* stores Tensor objects from the LOBPCG
    instance, it must make copies of these.
instance, it must make copies of these.
    If *tracker* sets *bvars["force_stop"] = True*, the iteration
    process will be hard-stopped.

  * **ortho_iparams** (*dict**, **optional*) -- various parameters
    to LOBPCG algorithm when using *method="ortho"*.

  * **ortho_fparams** (*dict**, **optional*) -- various parameters
    to LOBPCG algorithm when using *method="ortho"*.

  * **ortho_bparams** (*dict**, **optional*) -- various parameters
    to LOBPCG algorithm when using *method="ortho"*.

Returns:
      tensor of eigenvalues of size (*, k)
  X (Tensor): tensor of eigenvectors of size (*, m, k)

Return type:
      E (Tensor)
-[ References ]-
[Knyazev2001] Andrew V. Knyazev. (2001) Toward the Optimal
   Preconditioned Eigensolver: Locally Optimal Block Preconditioned
   Conjugate Gradient Method. SIAM J. Sci. Comput., 23(2), 517-541.
   (25 pages) https://epubs.siam.org/doi/abs/10.1137/S1064827500366124
[StathopoulosEtal2002] Andreas Stathopoulos and Kesheng Wu. (2002)
   A Block Orthogonalization Procedure with Constant Synchronization
   Requirements. SIAM J. Sci. Comput., 23(6), 2165-2182. (18 pages)
   https://epubs.siam.org/doi/10.1137/S1064827500370883
[DuerschEtal2018] Jed A. Duersch, Meiyue Shao, Chao Yang, Ming Gu.
   (2018) A Robust and Efficient Implementation of LOBPCG. SIAM J.
   Sci. Comput., 40(5), C655-C676. (22 pages)
   https://epubs.siam.org/doi/abs/10.1137/17M1129830
torch.signal.windows.general_hamming
torch.signal.windows.general_hamming(M, *, alpha=0.54, sym=True, dtype=None, layout=torch.strided, device=None, requires_grad=False)
Computes the general Hamming window.
The general Hamming window is defined as follows:
  w_n = \alpha - (1 - \alpha) \cos{ \left( \frac{2 \pi n}{M-1}
  \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:
      * alpha (float, optional) -- the window coefficient.
        Default: 0.54.
  * **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*.