Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reqs: add typing-extension dependency #1263

Merged
merged 6 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pip<24.0
immutabledict<2.2.6
typing-extensions>=4.7,<5
5 changes: 3 additions & 2 deletions xdsl/interpreters/shaped_array.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from __future__ import annotations

import operator
from dataclasses import dataclass
from itertools import accumulate, product
from math import prod
from typing import Generic, Iterable, TypeAlias, TypeVar

from attr import dataclass
from typing_extensions import Self

_T = TypeVar("_T")

Expand Down Expand Up @@ -64,7 +65,7 @@ def indices(self) -> Iterable[tuple[int, ...]]:
"""
yield from product(*(range(dim) for dim in self.shape))

def transposed(self, dim0: int, dim1: int) -> ShapedArray[_T]:
def transposed(self, dim0: int, dim1: int) -> Self:
"""
Returns a new ShapedArray, with the dimensions `dim0` and `dim1` transposed.
"""
Expand Down