+
    ˜°³jj  ã                   ó  € ^ RI HtHt ^ RIt^ RIHt ^ RIHtHt ^RIH	t	H
t
HtHt ]'       d/   ^ RIHt ]]]R3,          ,          ]],          ,          R,          tM]t]],          R,          t. ROt]! ]P*                  R	4      t]! ]P.                  R
4      t]! ]P2                  R4      tRR R llt]! ]P8                  R4      t]! ]P<                  R4      t]! ]P@                  R4      t!]! ]PD                  R4      t# ! R R4      t$R t%R# )é    )ÚAnyÚTYPE_CHECKINGN)ÚTensor)Ú_add_docstrÚ_sparse)ÚSparseSemiStructuredTensorÚ$SparseSemiStructuredTensorCUSPARSELTÚ!SparseSemiStructuredTensorCUTLASSÚto_sparse_semi_structured)Ú_dtype.Úcheck_sparse_tensor_invariantsaH  
sparse.addmm(mat, mat1, mat2, *, beta=1., alpha=1.) -> Tensor

This function does exact same thing as :func:`torch.addmm` in the forward,
except that it supports backward for sparse COO and CSR matrix :attr:`mat1`.
When :attr:`mat1` is a COO tensor it must have `sparse_dim = 2`.

Supports both CSR and COO storage formats.

.. note::
    **Gradient support:**

    - **COO @ Dense**: Backward is supported for both inputs. The gradient for the
      sparse input is returned as a sparse COO tensor.
    - **CSR @ Dense**: Backward is supported for both inputs. The gradient for the
      sparse input is returned as a sparse CSR tensor.
    - **CSC/BSR/BSC @ Dense**: Not supported.
    - **Sparse @ Sparse** (COO @ COO, CSR @ CSR): Forward works, but backward is
      not supported.

Args:
    mat (Tensor): a dense matrix to be added
    mat1 (Tensor): a sparse matrix to be multiplied
    mat2 (Tensor): a dense matrix to be multiplied
    beta (Number, optional): multiplier for :attr:`mat` (:math:`\beta`)
    alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`)
a  
    Performs a matrix multiplication of the sparse matrix :attr:`mat1`
    and the (sparse or strided) matrix :attr:`mat2`. Similar to :func:`torch.mm`, if :attr:`mat1` is a
    :math:`(n \times m)` tensor, :attr:`mat2` is a :math:`(m \times p)` tensor, out will be a
    :math:`(n \times p)` tensor.
    When :attr:`mat1` is a COO tensor it must have `sparse_dim = 2`.

    Supports both CSR and COO storage formats.

.. note::
    **Gradient support:**

    - **COO @ Dense**: Backward is supported for both inputs. The gradient for the
      sparse input is returned as a sparse COO tensor.
    - **CSR @ Dense**: Backward is supported for both inputs. The gradient for the
      sparse input is returned as a sparse CSR tensor.
    - **CSC/BSR/BSC @ Dense**: Not supported.
    - **Sparse @ Sparse** (COO @ COO, CSR @ CSR): Forward works, but backward is
      not supported.
    - **Mixed formats** (COO @ CSR, CSR @ COO): Not supported.

    This function also additionally accepts an optional :attr:`reduce` argument that allows
    specification of an optional reduction operation, mathematically performs the following operation:

.. math::

    z_{ij} = \bigoplus_{k = 0}^{K - 1} x_{ik} y_{kj}

where :math:`\bigoplus` defines the reduce operator. :attr:`reduce` is implemented only for
CSR storage format on CPU device.

Args:
    mat1 (Tensor): the first sparse matrix to be multiplied
    mat2 (Tensor): the second matrix to be multiplied, which could be sparse or dense
    reduce (str, optional): the reduction operation to apply for non-unique indices
        (:obj:`"sum"`, :obj:`"mean"`, :obj:`"amax"`, :obj:`"amin"`). Default :obj:`"sum"`.

Shape:
    The format of the output tensor of this function follows:
    - sparse x sparse -> sparse
    - sparse x dense -> dense

Example::

    >>> a = torch.tensor([[1., 0, 2], [0, 3, 0]]).to_sparse().requires_grad_()
    >>> a
    tensor(indices=tensor([[0, 0, 1],
                           [0, 2, 1]]),
           values=tensor([1., 2., 3.]),
           size=(2, 3), nnz=3, layout=torch.sparse_coo, requires_grad=True)
    >>> b = torch.tensor([[0, 1.], [2, 0], [0, 0]], requires_grad=True)
    >>> b
    tensor([[0., 1.],
            [2., 0.],
            [0., 0.]], requires_grad=True)
    >>> y = torch.sparse.mm(a, b)
    >>> y
    tensor([[0., 1.],
            [6., 0.]], grad_fn=<SparseAddmmBackward0>)
    >>> y.sum().backward()
    >>> a.grad
    tensor(indices=tensor([[0, 0, 1],
                           [0, 2, 1]]),
           values=tensor([1., 0., 2.]),
           size=(2, 3), nnz=3, layout=torch.sparse_coo)
    >>> c = a.detach().to_sparse_csr()
    >>> c
    tensor(crow_indices=tensor([0, 2, 3]),
           col_indices=tensor([0, 2, 1]),
           values=tensor([1., 2., 3.]), size=(2, 3), nnz=3,
           layout=torch.sparse_csr)
    >>> y1 = torch.sparse.mm(c, b, 'sum')
    >>> y1
    tensor([[0., 1.],
            [6., 0.]], grad_fn=<SparseMmReduceImplBackward0>)
    >>> y2 = torch.sparse.mm(c, b, 'max')
    >>> y2
    tensor([[0., 1.],
            [6., 0.]], grad_fn=<SparseMmReduceImplBackward0>)
aë  
sparse.sampled_addmm(input, mat1, mat2, *, beta=1., alpha=1., out=None) -> Tensor

Performs a matrix multiplication of the dense matrices :attr:`mat1` and :attr:`mat2` at the locations
specified by the sparsity pattern of :attr:`input`. The matrix :attr:`input` is added to the final result.

Mathematically this performs the following operation:

.. math::

    \text{out} = \alpha\ (\text{mat1} \mathbin{@} \text{mat2})*\text{spy}(\text{input}) + \beta\ \text{input}

where :math:`\text{spy}(\text{input})` is the sparsity pattern matrix of :attr:`input`, :attr:`alpha`
and :attr:`beta` are the scaling factors.
:math:`\text{spy}(\text{input})` has value 1 at the positions where :attr:`input` has non-zero values, and 0 elsewhere.

.. note::
    :attr:`input` must be a sparse CSR tensor. :attr:`mat1` and :attr:`mat2` must be dense tensors.

Args:
    input (Tensor): a sparse CSR matrix of shape `(m, n)` to be added and used to compute
        the sampled matrix 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 args:
    beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`)
    alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\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)
c                óV   € V ^8„  d   QhR\         R\        R\        R,          R\         /# )é   ÚinputÚdimÚdtypeNÚreturn)r   Ú	DimOrDimsÚDType)Úformats   "ÚV/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/sparse/__init__.pyÚ__annotate__r   Ù   s2   € ÷ C9ñ C9Œvð C9œIð C9´U¸Tµ\ð C9ÌVñ C9ó    c                óÐ   € Vf1   Ve   \         P                  ! W4      # \         P                  ! V 4      # Ve   \         P                  ! WVR7      # \         P                  ! WR7      # )a1	  Return the sum of each row of the given sparse tensor.

Returns the sum of each row of the sparse tensor :attr:`input` in the given
dimensions :attr:`dim`. If :attr:`dim` is a list of dimensions,
reduce over all of them. When sum over all ``sparse_dim``, this method
returns a dense tensor instead of a sparse tensor.

All summed :attr:`dim` are squeezed (see :func:`torch.squeeze`), resulting an output
tensor having :attr:`dim` fewer dimensions than :attr:`input`.

During backward, only gradients at ``nnz`` locations of :attr:`input`
will propagate back. Note that the gradients of :attr:`input` is coalesced.

Args:
    input (Tensor): the input sparse tensor
    dim (int or tuple of ints): a dimension or a list of dimensions to reduce. Default: reduce
        over all dims.
    dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor.
        Default: dtype of :attr:`input`.

Example::

    >>> nnz = 3
    >>> dims = [5, 5, 2, 3]
    >>> I = torch.cat([torch.randint(0, dims[0], size=(nnz,)),
                       torch.randint(0, dims[1], size=(nnz,))], 0).reshape(2, nnz)
    >>> V = torch.randn(nnz, dims[2], dims[3])
    >>> size = torch.Size(dims)
    >>> # xdoctest: +IGNORE_WANT("non-deterministic")
    >>> with torch.sparse.check_sparse_tensor_invariants():
    ...     S = torch.sparse_coo_tensor(I, V, size)
    >>> S
    tensor(indices=tensor([[2, 0, 3],
                           [2, 4, 1]]),
           values=tensor([[[-0.6438, -1.6467,  1.4004],
                           [ 0.3411,  0.0918, -0.2312]],

                          [[ 0.5348,  0.0634, -2.0494],
                           [-0.7125, -1.0646,  2.1844]],

                          [[ 0.1276,  0.1874, -0.6334],
                           [-1.9682, -0.5340,  0.7483]]]),
           size=(5, 5, 2, 3), nnz=3, layout=torch.sparse_coo)

    # when sum over only part of sparse_dims, return a sparse tensor
    >>> torch.sparse.sum(S, [1, 3])
    tensor(indices=tensor([[0, 2, 3]]),
           values=tensor([[-1.4512,  0.4073],
                          [-0.8901,  0.2017],
                          [-0.3183, -1.7539]]),
           size=(5, 2), nnz=3, layout=torch.sparse_coo)

    # when sum over all sparse dim, return a dense tensor
    # with summed dims squeezed
    >>> torch.sparse.sum(S, [0, 1, 3])
    tensor([-2.6596, -1.1450])
)r   )ÚtorchÚ_sparse_sum)r   r   r   s   &&&r   Úsumr   Ù   sZ   € ðt ‚}ØŠ?Ü×$Ò$ UÓ0Ð0ä×$Ò$ UÓ+Ð+àŠ?Ü×$Ò$ U°uÔ=Ð=ä×$Ò$ UÔ8Ð8r   a•  
sparse.softmax(input, dim, *, dtype=None) -> Tensor

Applies a softmax function.

Softmax is defined as:

:math:`\text{Softmax}(x_{i}) = \frac{exp(x_i)}{\sum_j exp(x_j)}`

where :math:`i, j` run over sparse tensor indices and unspecified
entries are ignores. This is equivalent to defining unspecified
entries as negative infinity so that :math:`exp(x_k) = 0` when the
entry with index :math:`k` has not specified.

It is applied to all slices along `dim`, and will re-scale them so
that the elements lie in the range `[0, 1]` and sum to 1.

Args:
    input (Tensor): input
    dim (int): A dimension along which softmax will be computed.
    dtype (:class:`torch.dtype`, optional): the desired data type
        of returned tensor.  If specified, the input tensor is
        casted to :attr:`dtype` before the operation is
        performed. This is useful for preventing data type
        overflows. Default: None
a¡  
sparse.spsolve(input, other, *, left=True) -> Tensor

Computes the solution of a square system of linear equations with
a unique solution. Its purpose is similar to :func:`torch.linalg.solve`,
except that the system is defined by a sparse CSR matrix with layout
`sparse_csr`.

Args:
    input (Tensor): a sparse CSR matrix of shape `(n, n)` representing the
        coefficients of the linear system.
    other (Tensor): a dense matrix of shape `(n, )` representing the right-hand
        side of the linear system.
    left (bool, optional): whether to solve the system for `input @ out = other`
        (default) or `out @ input = other`. Only `left=True` is supported.
a  
sparse.log_softmax(input, dim, *, dtype=None) -> Tensor

Applies a softmax function followed by logarithm.

See :class:`~torch.sparse.softmax` for more details.

Args:
    input (Tensor): input
    dim (int): A dimension along which softmax will be computed.
    dtype (:class:`torch.dtype`, optional): the desired data type
        of returned tensor.  If specified, the input tensor is
        casted to :attr:`dtype` before the operation is
        performed. This is useful for preventing data type
        overflows. Default: None
a(  
sparse.spdiags(diagonals, offsets, shape, layout=None) -> Tensor

Creates a sparse 2D tensor by placing the values from rows of
:attr:`diagonals` along specified diagonals of the output

The :attr:`offsets` tensor controls which diagonals are set.

- If :attr:`offsets[i]` = 0, it is the main diagonal
- If :attr:`offsets[i]` < 0, it is below the main diagonal
- If :attr:`offsets[i]` > 0, it is above the main diagonal

The number of rows in :attr:`diagonals` must match the length of :attr:`offsets`,
and an offset may not be repeated.

Args:
    diagonals (Tensor): Matrix storing diagonals row-wise
    offsets (Tensor): The diagonals to be set, stored as a vector
    shape (2-tuple of ints): The desired shape of the result
Keyword args:
    layout (:class:`torch.layout`, optional): The desired layout of the
        returned tensor. ``torch.sparse_coo``, ``torch.sparse_csc`` and ``torch.sparse_csr``
        are supported. Default: ``torch.sparse_coo``

Examples:

Set the main and first two lower diagonals of a matrix::

    >>> diags = torch.arange(9).reshape(3, 3)
    >>> diags
    tensor([[0, 1, 2],
            [3, 4, 5],
            [6, 7, 8]])
    >>> s = torch.sparse.spdiags(diags, torch.tensor([0, -1, -2]), (3, 3))
    >>> s
    tensor(indices=tensor([[0, 1, 2, 1, 2, 2],
                           [0, 1, 2, 0, 1, 0]]),
           values=tensor([0, 1, 2, 3, 4, 6]),
           size=(3, 3), nnz=6, layout=torch.sparse_coo)
    >>> s.to_dense()
    tensor([[0, 0, 0],
            [3, 1, 0],
            [6, 4, 2]])


Change the output layout::

    >>> diags = torch.arange(9).reshape(3, 3)
    >>> diags
    tensor([[0, 1, 2],[3, 4, 5], [6, 7, 8])
    >>> s = torch.sparse.spdiags(diags, torch.tensor([0, -1, -2]), (3, 3), layout=torch.sparse_csr)
    >>> s
    tensor(crow_indices=tensor([0, 1, 3, 6]),
           col_indices=tensor([0, 0, 1, 0, 1, 2]),
           values=tensor([0, 3, 1, 6, 4, 2]), size=(3, 3), nnz=6,
           layout=torch.sparse_csr)
    >>> s.to_dense()
    tensor([[0, 0, 0],
            [3, 1, 0],
            [6, 4, 2]])

Set partial diagonals of a large output::

    >>> diags = torch.tensor([[1, 2], [3, 4]])
    >>> offsets = torch.tensor([0, -1])
    >>> torch.sparse.spdiags(diags, offsets, (5, 5)).to_dense()
    tensor([[1, 0, 0, 0, 0],
            [3, 2, 0, 0, 0],
            [0, 4, 0, 0, 0],
            [0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0]])

.. note::

    When setting the values along a given diagonal the index into the diagonal
    and the index into the row of :attr:`diagonals` is taken as the
    column index in the output. This has the effect that when setting a diagonal
    with a positive offset `k` the first value along that diagonal will be
    the value in position `k` of the row of :attr:`diagonals`

Specifying a positive offset::

    >>> diags = torch.tensor([[1, 2, 3], [1, 2, 3], [1, 2, 3]])
    >>> torch.sparse.spdiags(diags, torch.tensor([0, 1, 2]), (5, 5)).to_dense()
    tensor([[1, 2, 3, 0, 0],
            [0, 2, 3, 0, 0],
            [0, 0, 3, 0, 0],
            [0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0]])
c                   óp   a € ] tR tRt o Rt]R 4       t]R 4       t]R 4       tRR lt	R t
R tR	 tR
tV tR# )r   iÆ  a]  A tool to control checking sparse tensor invariants.

The following options exists to manage sparse tensor invariants
checking in sparse tensor construction:

1. Using a context manager:

   .. code:: python

       with torch.sparse.check_sparse_tensor_invariants():
           run_my_model()

2. Using a procedural approach:

   .. code:: python

       prev_checks_enabled = torch.sparse.check_sparse_tensor_invariants.is_enabled()
       torch.sparse.check_sparse_tensor_invariants.enable()

       run_my_model()

       if not prev_checks_enabled:
           torch.sparse.check_sparse_tensor_invariants.disable()

3. Using function decoration:

   .. code:: python

       @torch.sparse.check_sparse_tensor_invariants()
       def run_my_model():
           ...

       run_my_model()

4. Using ``check_invariants`` keyword argument in sparse tensor constructor call.
   For example:

   >>> torch.sparse_csr_tensor([0, 1, 3], [0, 1], [1, 2], check_invariants=True)
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
   RuntimeError: `crow_indices[..., -1] == nnz` is not satisfied.
c                 ó>   € \         P                  P                  4       # )a  Return True if the sparse tensor invariants checking is enabled.

.. note::

    Use :func:`torch.sparse.check_sparse_tensor_invariants.enable` or
    :func:`torch.sparse.check_sparse_tensor_invariants.disable` to
    manage the state of the sparse tensor invariants checks.
)r   Ú_CÚ_check_sparse_tensor_invariants© r   r   Ú
is_enabledÚ)check_sparse_tensor_invariants.is_enabledò  s   € ô �x‰x×7Ñ7Ó9Ð9r   c                 óD   € \         P                  P                  R4       R# )a(  Enable sparse tensor invariants checking in sparse tensor constructors.

.. note::

    By default, the sparse tensor invariants checks are disabled. Use
    :func:`torch.sparse.check_sparse_tensor_invariants.is_enabled` to
    retrieve the current state of sparse tensor invariants checking.

.. note::

    The sparse tensor invariants check flag is effective to all sparse
    tensor constructors, both in Python and ATen.

The flag can be locally overridden by the ``check_invariants``
optional argument of the sparse tensor constructor functions.
TN©r   r    Ú#_set_check_sparse_tensor_invariantsr"   r   r   ÚenableÚ%check_sparse_tensor_invariants.enableþ  s   € ô$ 	�‰×4Ñ4°TÖ:r   c                 óD   € \         P                  P                  R4       R# )zŸDisable sparse tensor invariants checking in sparse tensor constructors.

See :func:`torch.sparse.check_sparse_tensor_invariants.enable` for more information.
FNr&   r"   r   r   ÚdisableÚ&check_sparse_tensor_invariants.disable  s   € ô 	�‰×4Ñ4°UÖ;r   c                ó    € Wn         R V n        R # ©N)ÚstateÚsaved_state)Úselfr(   s   &&r   Ú__init__Ú'check_sparse_tensor_invariants.__init__  s   € ØŒ
Ø(,ˆÖr   c                ó´   € V P                   e   \        R4      hV P                  4       V n         \        P                  P                  V P                  4       R # )NzqThis context manager instance is already activated. Use a different context manager instance for context nesting.)r0   ÚRuntimeErrorr#   r   r    r'   r/   )r1   s   &r   Ú	__enter__Ú(check_sparse_tensor_invariants.__enter__  sH   € Ø×ÑÒ'ÜðQóð ð  Ÿ?™?Ó,ˆÔÜ�‰×4Ñ4°T·Z±ZÖ@r   c                ó˜   € V P                   f   \        R4      h\        P                  P	                  V P                   4       R V n         R # )Nz&saved_state should not be None on exit)r0   ÚAssertionErrorr   r    r'   )r1   ÚtypeÚvalueÚ	tracebacks   &&&&r   Ú__exit__Ú'check_sparse_tensor_invariants.__exit__(  s:   € Ø×ÑÒ#Ü Ð!IÓJÐJÜ�‰×4Ñ4°T×5EÑ5EÔFØˆÖr   c                ó   a a€ VV 3R  lpV# )c                  ó˜   <€ \        S4      ! SP                  4      ;_uu_ 4        S! V / VB uuR R R 4       #   + '       g   i     R # ; ir.   )r:   r/   )ÚargsÚkwargsÚmthr1   s   *,€€r   Útest_mthÚ9check_sparse_tensor_invariants.__call__.<locals>.test_mth0  s2   ø€ Ü�d”˜DŸJ™J×'Õ'Ù˜DÐ+ FÑ+÷ (×'×'Ó'ús	   ¥8¸A		r"   )r1   rC   rD   s   ff r   Ú__call__Ú'check_sparse_tensor_invariants.__call__/  s   ù€ ö	,ð ˆr   )r0   r/   N)T)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ústaticmethodr#   r(   r+   r2   r6   r=   rF   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r   Æ  sa   ø‡ € ñ)ðV ñ	:ó ð	:ð ñ;ó ð;ð& ñ<ó ð<ô-òAò ÷ð r   c                ó   a € V 3R lpV# )aÜ  Decorate function, to extend gradcheck for sparse tensors.

Decorator for torch.autograd.gradcheck or its functools.partial
variants that extends the gradcheck function with support to input
functions that operate on or/and return sparse tensors.

The specified gradcheck function itself is guaranteed to operate
on strided tensors only.

For example:

>>> warnings.filterwarnings(
...     "ignore", message=".*Sparse CSR tensor support is in beta state"
... )  # docs: hide
>>> gradcheck = torch.sparse.as_sparse_gradcheck(torch.autograd.gradcheck)
>>> x = (
...     torch.tensor([[0, 1], [2, 3]], dtype=torch.float64)
...     .to_sparse_coo()
...     .requires_grad_(True)
... )
>>> gradcheck(lambda x: x.to_sparse_csr(), x)
True
c                óä  <a aaaa	a
a€ VP                  RR4      o\        P                  \        P                  \        P                  \        P
                  \        P                  0o\        P                  \        P                  \        P
                  \        P                  0o
\        P
                  \        P                  0o	RoVVV	V3R lpVV
3R loV VVV3R lpWC! V4      3pS! V/ VB # )z‘
Create gradcheck with support for sparse tensors.

Same as :func:`torch.autograd.gradcheck` but with sparse tensors inputs and outputs support.
ÚmaskedFÚ__STRIDED_REPRESENTATION__c                ó¶  <€ \        V \        \        34      '       g   V 3p . pV  EF¦  p\        V\        P                  4      '       Edq   VP
                  '       Ed^   VP                  S9   EdL   RVP                  RVP                  /pS	'       gù   VP                  VP                  4       ,
          VP                  4       ,
          pVP                  S
9   d,   VP                  4       P                  V^,           V^,            MRp\        P                  ! VP                  VP                  \        P                  R7      P                  VP                  VVP                  4       R7      pVP!                  4       P#                  V4      pVP                  \        P$                  J dA   VP'                  VP)                  4       VP+                  4       R7       VP-                  4       pM®VP                  \        P.                  \        P0                  09   dA   VP'                  VP3                  4       VP5                  4       R7       VP                  4       pM?VP'                  VP7                  4       VP9                  4       R7       VP                  4       pVP;                  SW7P=                  R4      34       EK•  VP?                  V4       EK©  	  \        V4      # )	ziConvert differentiable non-strided tensors to a representation containing differentiable strided tensors.ÚlayoutÚshapeN)Údevicer   )rV   Ú	blocksizeÚ	dense_dim)ÚindicesÚis_coalesced)Úcompressed_indicesÚplain_indicesT) Ú
isinstanceÚlistÚtupler   r   Úrequires_gradrV   rW   ÚndimrZ   Ú
sparse_dimÚvaluesÚonesrX   ÚboolÚ	to_sparseÚto_denseÚsparse_maskÚ
sparse_cooÚupdateÚ_indicesr\   Ú_valuesÚ
sparse_csrÚ
sparse_bsrÚcrow_indicesÚcol_indicesÚccol_indicesÚrow_indicesÚextendÚrequires_grad_Úappend)rA   Únew_argsÚobjÚdÚ	batch_dimrY   Ú	full_maskre   ÚSTRIDED_REPRESENTATIONrS   Úsparse_block_layoutsÚsparse_layoutss   &       €€€€r   Ú!convert_to_strided_representationÚeas_sparse_gradcheck.<locals>.gradcheck_with_sparse_support.<locals>.convert_to_strided_representationg  s1  ø€ ä˜d¤T¬5 M×2Ò2Ø�w�Ø"$ˆHÜ�ä˜s¤E§L¡L×1Ó1Ø×)×)Ñ)ØŸ
™
 nÕ4ð ! #§*¡*Ø §¡ð�A÷ "à$'§H¡H¨s¯}©}«Õ$>ÀÇÁÓAQÕ$Q˜	ð  #Ÿz™zÐ-AÔAð  ŸJ™J›L×.Ñ.¨y¸1­}¸yÈ1½}ÑMà!%ð "ô
 %*§J¢JØŸI™I¨c¯j©jÄÇ
Á
ô%ç#™)Ø#&§:¡:Ø&/Ø&)§m¡m£oð $ó ð "ð "Ÿl™l›n×8Ñ8¸ÓC˜Ø—z‘z¤U×%5Ñ%5Ó5àŸ™à$'§L¡L£Nà),×)9Ñ)9Ó);ð	 !ô ð "%§¡£™ØŸ™¬×(8Ñ(8¼%×:JÑ:JÐ'KÔKàŸ™à/2×/?Ñ/?Ó/Aà*-¯/©/Ó*;ð	 !ô ð "%§¡£™ð Ÿ™à/2×/?Ñ/?Ó/Aà*-¯/©/Ó*;ð	 !ô ð "%§¡£˜Ø—O‘OØ/°×4IÑ4IÈ$Ó4OÐP÷ð —O‘O C×(ñs ôt ˜“?Ð"r   c                ó*  <€ . p\        V 4      p V '       dô   V P                  ^ 4      pVS8X  dÉ   V P                  ^ 4      V P                  ^ 4      rCVR,          \        P                  J d1   \        P                  ! VR,          VVR,          VR,          R7      pM\VR,          S9   d9   \        P
                  ! VR,          VR,          VVR,          VR,          R7      pM\        R	VR,           R
24      hVP                  V4       Kû  \        V4      # )zNRestore non-strided differentiable tensors from their strided representations.rV   r[   rW   r\   )Úsizer\   r]   r^   )rƒ   rV   zconversion of z! strided representation to tensor)	r`   Úpopr   rk   Úsparse_coo_tensorÚsparse_compressed_tensorÚNotImplementedErrorrw   ra   )rA   rx   Úarz   re   r}   Úsparse_compressed_layoutss   &    €€r   Ú#restore_from_strided_representationÚgas_sparse_gradcheck.<locals>.gradcheck_with_sparse_support.<locals>.restore_from_strided_representation¨  sõ   ø€ àˆHÜ˜“:ˆDßØ—H‘H˜Q“K�ØÐ.Ô.Ø $§¡¨£¨T¯X©X°a«[�vØ˜•{¤e×&6Ñ&6Ó6Ü!×3Ò3Ø˜i�LØ"Ø!" 7¥Ø)*¨>Õ):ô	™ð ˜8�Ð(AÔAÜ!×:Ò:ØÐ2Õ3Ø˜oÕ.Ø"Ø!" 7¥Ø#$ X¥;ô™ô 2Ø,¨Q¨x­[¨MÐ9ZÐ[óð ð —‘ Ö"Ü˜“?Ð"r   c                  ó.  <€ S! V 4      pS! V/ VB p\        V\        \        34      '       d   \        V4      MV3p\        ;QJ d    . VV3R  lV 4       F  NK  	  5M! VV3R  lV 4       4      p\        V\        \        34      '       d   V# V^ ,          # )c              3   óÒ   <"  € T F\  p\        V\        P                  4      '       d6   VP                  '       d$   VP                  S9   d   VP                  SR 7      MTx € K^  	  R# 5i))Úmasked_gradN)r_   r   r   rb   rV   ri   )Ú.0ÚorS   r   s   & €€r   Ú	<genexpr>Úcas_sparse_gradcheck.<locals>.gradcheck_with_sparse_support.<locals>.func_wrapper.<locals>.<genexpr>Ð  sY   øé € ð 	$ñ )�Aô " !¤U§\¡\×2Ò2ØŸŸ˜ØŸ™ NÔ2ð —J‘J¨6�JÔ2ð ô	ó )ùs
   ƒ6A'º-A')r_   r`   ra   )	rA   rB   Úrestored_argsÚoutputsÚstrided_outputsÚfuncrS   rŠ   r   s	   *,   €€€€r   Úfunc_wrapperÚPas_sparse_gradcheck.<locals>.gradcheck_with_sparse_support.<locals>.func_wrapperÆ  sœ   ø€ Ù?ÀÓEˆMñ ˜MÐ4¨VÑ4ˆGô #-¨W´t¼U°m×"DÒ"D”�g”È7È*ð ÷ $œeõ 	$ñ )ó	$Ÿe™eõ 	$ñ )ó	$ó 	ˆOô ˜g¬¬e }×5Ò5ð  ðð % QÕ'ðr   )r„   r   rk   ro   Ú
sparse_cscrp   Ú
sparse_bsc)r–   ÚinputsrB   r€   r—   rA   r}   rS   rŠ   r~   r‰   r   Ú	gradchecks   f&,   @@@@@@€r   Úgradcheck_with_sparse_supportÚ:as_sparse_gradcheck.<locals>.gradcheck_with_sparse_supportP  sÒ   ÿ€ ð —‘˜H eÓ,ˆä×ÑÜ×ÑÜ×ÑÜ×ÑÜ×Ñð
ˆô ×ÑÜ×ÑÜ×ÑÜ×Ñð	%
Ð!ô !&× 0Ñ 0´%×2BÑ2BÐCÐØ!=Ð÷?	#ð ?	#öB	#÷<	ð 	ð6 Ð?ÀÓGÐHˆá˜$Ð) &Ñ)Ð)r   r"   )rœ   r�   s   f r   Úas_sparse_gradcheckrŸ   7  s   ø€ õ2S*ðj )Ð(r   )Úaddmmr   Úmmr   ÚsoftmaxÚsolveÚlog_softmaxr   r
   r	   r   rŸ   )NN)&Útypingr   r   r   r   Útorch._Cr   r   Úsemi_structuredr   r	   r
   r   Útorch.typesr   r   Úintra   r`   r   Ú__all__Ú_sparse_addmmr    Ú
_sparse_mmr¡   Úsparse_sampled_addmmÚsampled_addmmr   Ú_sparse_softmaxr¢   Ú_spsolveÚspsolveÚ_sparse_log_softmaxr¤   Ú_spdiagsÚspdiagsr   rŸ   r"   r   r   Ú<module>rµ      s9  ð÷ &ã Ý ß )÷ó ÷ Ý+à�e˜C ˜H•oÕ%¨¨S­	Õ1°DÕ8�Ið €EØ�c•
˜TÕ!€Iò€ñ  	Ø×Ñðó	€ñ@ Ø×ÑðOóR€ñj Ø× Ñ ð1ó4€÷nC9ñL Ø×Ñðó€ñ> Ø×Ñðó€ñ( Ø×Ñðó€ñ* Ø×ÑðYó\€÷~nñ nôbn)r   