Repository navigation
Add MPS backend - #52
Open
zitongzhan wants to merge 6 commits into
Open
zitongzhan wants to merge 6 commits into
zitongzhan wants to merge 6 commits into
Conversation
| kwargs = {} if kwargs is None else kwargs | ||
| aten = torch.ops.aten | ||
| if func in (aten.mv.default, aten.mv.out, aten.mm.default, aten.mm.out): | ||
| matrix, x = args |
| if isinstance(matrix, _SparseTensor) and not isinstance(x, _SparseTensor): | ||
| return matrix.matvec(x, out=kwargs.get("out")) | ||
| elif func is aten.add.Tensor: | ||
| left, right = args |
| if not transpose: | ||
| use_tiles, tile_size = _tile_dispatch(values.shape[0], br, bc, size[0], values.device.type, tile_size) | ||
| else: | ||
| use_tiles = False |
| residual = torch.linspace(-1, 1, 6, device=device) | ||
| # Populate the transpose before creating the detached alias. Mutations via | ||
| # that alias must invalidate both stored values and canonical-index state. | ||
| transpose @ residual |
| from pypose.optim.solver import CG | ||
| from bae.sparse.py_ops import spdiags_ | ||
| from .linear_operator import DiagonalMatVec | ||
| from ..sparse import py_ops as _py_ops # Registers native sparse diagonal dispatch. |
| try: | ||
| import warp as wp | ||
| from warp import sparse as wps | ||
| from warp.optim import linear as wpol |
| from warp import sparse | ||
| from warp.optim import linear | ||
| from bae.sparse.warp_wrappers import format_vec_for_bsr, torchbsr2wp, wp2torchbsr | ||
| except ImportError: |
| import warp as wp | ||
| from warp import sparse as wpsparse | ||
| from bae.sparse.warp_wrappers import format_vec_for_bsr | ||
| except ImportError: |
| from warp import sparse as wps | ||
| from warp.optim import linear as wpol | ||
| wp.init() | ||
| except ImportError: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.