From 72f073438c512af2ba2a88f8b9934aa32a9f251d Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Wed, 4 Oct 2023 10:40:59 -0400 Subject: [PATCH 1/6] Clean up Github Actions --- .github/release-drafter.yml | 28 ------------- .github/workflows/build_windows.yml | 41 ------------------- .../workflows/{build_ubuntu.yml => lint.yml} | 22 ++++------ .github/workflows/release-drafter.yml | 16 -------- .../workflows/{test_ubuntu.yml => test.yml} | 7 ++-- .github/workflows/test_windows.yml | 0 6 files changed, 13 insertions(+), 101 deletions(-) delete mode 100644 .github/release-drafter.yml delete mode 100644 .github/workflows/build_windows.yml rename .github/workflows/{build_ubuntu.yml => lint.yml} (70%) delete mode 100644 .github/workflows/release-drafter.yml rename .github/workflows/{test_ubuntu.yml => test.yml} (88%) delete mode 100644 .github/workflows/test_windows.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index 0ce0984..0000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Release drafter configuration https://github.com/release-drafter/release-drafter#configuration -# Emojis were chosen to match the https://gitmoji.carloscuesta.me/ - -name-template: "v$NEXT_PATCH_VERSION" -tag-template: "v$NEXT_PATCH_VERSION" - -categories: - - title: ":rocket: Features" - labels: [enhancement, feature] - - title: ":wrench: Fixes & Refactoring" - labels: [bug, refactoring, bugfix, fix] - - title: ":package: Build System & CI/CD" - labels: [build, ci, testing] - - title: ":boom: Breaking Changes" - labels: [breaking] - - title: ":pencil: Documentation" - labels: [documentation] - - title: ":arrow_up: Dependencies updates" - labels: [dependencies] - -template: | - ## What’s Changed - - $CHANGES - - ## :busts_in_silhouette: List of contributors - - $CONTRIBUTORS diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml deleted file mode 100644 index cf88912..0000000 --- a/.github/workflows/build_windows.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: build_windows - -on: - pull_request: - branches: [ main ] - -jobs: - build: - runs-on: windows-latest - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11"] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4.6.1 - with: - python-version: ${{ matrix.python-version }} - - name: Set up cache - uses: actions/cache@v3.3.1 - with: - path: .venv - key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ruff mypy - if exist requirements.txt pip install -r requirements.txt - - - name: Lint with ruff - run: | - # stop the build if there are Python syntax errors or undefined names - ruff --format=github --select=E9,F63,F7,F82 --target-version=py39 pytorch_finufft - # default set of ruff rules with GitHub Annotations - ruff --format=github --target-version=py37 pytorch_finufft - - - name: Lint with mypy - run: | - mypy pytorch_finufft diff --git a/.github/workflows/build_ubuntu.yml b/.github/workflows/lint.yml similarity index 70% rename from .github/workflows/build_ubuntu.yml rename to .github/workflows/lint.yml index 9c18aba..75d0712 100644 --- a/.github/workflows/build_ubuntu.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: build_ubuntu +name: lint on: push: @@ -9,38 +9,34 @@ on: jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11"] - steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python uses: actions/setup-python@v4.6.1 with: - python-version: ${{ matrix.python-version }} + python-version: "3.11" - name: Set up cache uses: actions/cache@v3.3.1 with: path: .venv - key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} - + key: venv-${{ hashFiles('pyproject.toml', 'requirements.txt') }} + - name: Install dependencies run: | python -m pip install --upgrade pip - pip install ruff pytest mypy + pip install ruff mypy if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install -e . - + - name: Lint with ruff run: | # stop the build if there are Python syntax errors or undefined names - ruff --format=github --select=E9,F63,F7,F82 --target-version=py39 pytorch_finufft + ruff --format=github --select=E9,F63,F7,F82 --target-version=py311 pytorch_finufft # default set of ruff rules with GitHub Annotations ruff --format=github --target-version=py37 pytorch_finufft - name: Lint with mypy run: | mypy pytorch_finufft/ - + diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index 58efdb9..0000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Release Drafter - -on: - push: - # branches to consider in the event; optional, defaults to all - branches: - - master - -jobs: - update_release_draft: - runs-on: ubuntu-latest - steps: - # Drafts your next Release notes as Pull Requests are merged into "master" - - uses: release-drafter/release-drafter@v5.23.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test_ubuntu.yml b/.github/workflows/test.yml similarity index 88% rename from .github/workflows/test_ubuntu.yml rename to .github/workflows/test.yml index cb72772..afaae47 100644 --- a/.github/workflows/test_ubuntu.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: test_ubuntu +name: test on: push: @@ -24,13 +24,14 @@ jobs: uses: actions/cache@v3.3.1 with: path: .venv - key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} + key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt') }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install ruff pytest mypy + pip install pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install . - name: Pytest run: | diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml deleted file mode 100644 index e69de29..0000000 From db6aa301a1c69b6f893fd72381bd0d01624e59fc Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Wed, 4 Oct 2023 10:58:25 -0400 Subject: [PATCH 2/6] Format with black, re-write pyproject --- .github/dependabot.yml | 10 --- .github/workflows/lint.yml | 6 +- .github/workflows/test.yml | 5 +- pyproject.toml | 109 +++++++++--------------------- pytorch_finufft/__init__.py | 16 +---- pytorch_finufft/_err.py | 25 +++---- pytorch_finufft/functional.py | 53 +++++++++------ requirements.txt | 11 --- tests/test_1d/test_backward_1d.py | 4 +- tests/test_1d/test_forward_1d.py | 20 ++---- tests/test_2d/test_backward_2d.py | 8 +-- tests/test_3d/test_forward_3d.py | 12 ++-- 12 files changed, 98 insertions(+), 181 deletions(-) delete mode 100644 requirements.txt diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f6c346e..66727a7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -23,13 +23,3 @@ updates: commit-message: prefix: ":arrow_up:" open-pull-requests-limit: 50 - - - package-ecosystem: "docker" - directory: "/docker" - schedule: - interval: "weekly" - allow: - - dependency-type: "all" - commit-message: - prefix: ":arrow_up:" - open-pull-requests-limit: 50 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 75d0712..177b74c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,7 +7,7 @@ on: branches: [ main ] jobs: - build: + mypy_ruff: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -32,9 +32,9 @@ jobs: - name: Lint with ruff run: | # stop the build if there are Python syntax errors or undefined names - ruff --format=github --select=E9,F63,F7,F82 --target-version=py311 pytorch_finufft + ruff --output-format=github --select=E9,F63,F7,F82 --target-version=py37 pytorch_finufft # default set of ruff rules with GitHub Annotations - ruff --format=github --target-version=py37 pytorch_finufft + ruff --output-format=github --target-version=py37 pytorch_finufft - name: Lint with mypy run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index afaae47..afe3156 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ on: branches: [ main ] jobs: - build: + pytest: runs-on: ubuntu-latest strategy: matrix: @@ -24,13 +24,12 @@ jobs: uses: actions/cache@v3.3.1 with: path: .venv - key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt') }} + key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install . - name: Pytest diff --git a/pyproject.toml b/pyproject.toml index 3eb9df8..7d0a92d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,22 +1,18 @@ -# Poetry pyproject.toml: https://python-poetry.org/docs/pyproject/ [build-system] -requires = ["poetry_core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" -[tool.poetry] +[project] name = "pytorch_finufft" -version = "0.0.0" description = "Pytorch bindings for the FINUFFT Library" readme = "README.md" -authors = ["Matthew Meeker ", "Michael Eickenberg ", "Brian Ward "] -license = "MIT" -repository = "https://github.com/flatironinstitute/pytorch-finufft" -homepage = "https://github.com/flatironinstitute/pytorch-finufft" - -# Keywords description https://python-poetry.org/docs/pyproject/#keywords -keywords = [] #! Update me - -# Pypi classifiers: https://pypi.org/classifiers/ +authors = [ + {name = "Matthew Meeker", email="mmeeker@flatironinstitute.org"}, + {name = "Michael Eickenberg", email="meickenberg@flatironinstitute.org"}, + {name = "Brian Ward", email="bward@flatironinstitute.org"}, +] +license = { text = "MIT" } +dependencies = ["finufft", "torch >= 2", "numpy", "scipy"] classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -26,51 +22,25 @@ classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.9", ] +dynamic = ["version"] +[project.urls] +repository = "https://github.com/flatironinstitute/pytorch-finufft" +homepage = "https://github.com/flatironinstitute/pytorch-finufft" +[project.optional-dependencies] +dev = ["black", "mypy", "isort", "ruff", "pytest"] -[tool.poetry.dependencies] -python = ">=3.9,<3.12" -finufft = "^2.1.0" -torch = "^2.0.1" -numpy = "^1.24.3" -scipy = "^1.10.1" -nvidia-cublas-cu11 = { version = "11.10.3.66", platform = 'linux' } -nvidia-cuda-cupti-cu11 = { version = "11.7.101", platform = 'linux' } -nvidia-cuda-nvrtc-cu11 = { version = "11.7.99", platform = 'linux' } -nvidia-cuda-runtime-cu11 = { version = "11.7.99", platform = 'linux' } -nvidia-cudnn-cu11 = { version = "8.5.0.96", platform = 'linux' } -nvidia-cufft-cu11 = { version = "10.9.0.58", platform = 'linux' } -nvidia-curand-cu11 = { version = "10.2.10.91", platform = 'linux' } -nvidia-cusolver-cu11 = { version = "11.4.0.1", platform = 'linux' } -nvidia-cusparse-cu11 = { version = "11.7.4.91", platform = 'linux' } -nvidia-nccl-cu11 = { version = "2.14.3", platform = 'linux' } -nvidia-nvtx-cu11 = { version = "11.7.91", platform = 'linux' } -triton = { version = "2.0.0", platform = 'linux' } +[tool.setuptools.dynamic] +version = { attr = "pytorch_finufft.__version__" } -[tool.poetry.dev-dependencies] -bandit = "^1.7.1" -black = {version = "^23.3.0", allow-prereleases = true} -darglint = "^1.8.1" -isort = {extras = ["colors"], version = "^5.10.1"} -mypy = "^1.0" -mypy-extensions = "^1.0.0" -pre-commit = "^3.3.2" -pydocstyle = "^6.1.1" -pylint = "^2.11.1" -pytest = "^7.3.1" -pyupgrade = "^3.4.0" -coverage = "^7.2.7" -coverage-badge = "^1.1.0" -pytest-html = "^3.1.1" -pytest-cov = "^4.1.0" +[tool.setuptools.packages] +find = {} [tool.black] -# https://github.com/psf/black target-version = ["py39"] -line-length = 80 +line-length = 88 color = true - exclude = ''' /( \.git @@ -88,25 +58,13 @@ exclude = ''' ''' [tool.isort] -# https://github.com/timothycrosley/isort/ -py_version = 39 -line_length = 88 - -known_typing = ["typing", "types", "typing_extensions", "mypy", "mypy_extensions"] -sections = ["FUTURE", "TYPING", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] -include_trailing_comma = true profile = "black" -multi_line_output = 3 -indent = 4 -color_output = true [tool.mypy] -# https://mypy.readthedocs.io/en/latest/config_file.html#using-a-pyproject-toml-file python_version = 3.9 pretty = true show_traceback = true color_output = true - allow_redefinition = false check_untyped_defs = true disallow_any_generics = true @@ -128,17 +86,16 @@ warn_unused_ignores = true [tool.pytest.ini_options] -# https://docs.pytest.org/en/6.2.x/customize.html#pyproject-toml -# Directories that are not visited by pytest collector: -norecursedirs =["hooks", "*.egg", ".eggs", "dist", "build", "docs", ".tox", ".git", "__pycache__"] -doctest_optionflags = ["NUMBER", "NORMALIZE_WHITESPACE", "IGNORE_EXCEPTION_DETAIL"] - -# Extra options: -addopts = [ - "--strict-markers", - "--tb=short", - "--doctest-modules", - "--doctest-continue-on-failure", +norecursedirs = [ + "hooks", + "*.egg", + ".eggs", + "dist", + "build", + "docs", + ".tox", + ".git", + "__pycache__", ] [tool.coverage.run] @@ -149,7 +106,3 @@ source = "pytorch_finufft" [coverage.run] branch = true - -[coverage.report] -fail_under = 50 -show_missing = true diff --git a/pytorch_finufft/__init__.py b/pytorch_finufft/__init__.py index a30f0f0..64cbff2 100644 --- a/pytorch_finufft/__init__.py +++ b/pytorch_finufft/__init__.py @@ -1,17 +1,7 @@ # type: ignore[attr-defined] """Pytorch bindings for the FINUFFT Library""" -import sys -from importlib import metadata as importlib_metadata +from . import functional, nn -from . import functional - - -def get_version() -> str: - try: - return importlib_metadata.version(__name__) - except importlib_metadata.PackageNotFoundError: # pragma: no cover - return "unknown" - - -version: str = get_version() +__all__ = ["functional", "nn"] +__version__ = "0.1.0" diff --git a/pytorch_finufft/_err.py b/pytorch_finufft/_err.py index 4839c3a..c2116d7 100644 --- a/pytorch_finufft/_err.py +++ b/pytorch_finufft/_err.py @@ -54,9 +54,7 @@ def _type1_checks( # Base the dtype and precision checks off of that of values complex_dtype = values.dtype - real_dtype = ( - torch.float32 if complex_dtype is torch.complex64 else torch.float64 - ) + real_dtype = torch.float32 if complex_dtype is torch.complex64 else torch.float64 # Determine if 1, 2, or 3d and figure out if points, points_x, points_y dimension = len(points_tuple) @@ -81,19 +79,18 @@ def _type1_checks( # Ensure all points have the same type and correct precision if points_tuple[i].dtype is not real_dtype: raise TypeError( - f"Got points{coord_char} that is not {real_dtype} valued; points{coord_char} must also be the same precision as values.", + f"Got points{coord_char} that is not {real_dtype} valued; " + f"points{coord_char} must also be the same precision as values.", ) - if type(output_shape) is int: + if isinstance(output_shape, int): if not output_shape > 0: raise ValueError("Got output_shape that was not positive integer") else: # In this case, output_shape is a tuple ergo iterable for i in output_shape: if not i > 0: - raise ValueError( - "Got output_shape that was not positive integer" - ) + raise ValueError("Got output_shape that was not positive integer") _device_assertions(values, points_tuple) @@ -132,17 +129,14 @@ def _type2_checks( raise TypeError("Got values that is not complex-valued") complex_dtype = targets.dtype - real_dtype = ( - torch.float32 if complex_dtype is torch.complex64 else torch.float64 - ) + real_dtype = torch.float32 if complex_dtype is torch.complex64 else torch.float64 dimension = len(points_tuple) targets_dim = len(targets.shape) if dimension != targets_dim: raise ValueError( - f"For type 2 {dimension}d FINUFFT, targets must be a {dimension}d " - "tensor" + f"For type 2 {dimension}d FINUFFT, targets must be a {dimension}d " "tensor" ) coord_char = "" @@ -170,7 +164,7 @@ def _type3_checks( ) -> None: # raise ValueError("Not yet implemented!") - dimension = len(points_tuple) + # dimension = len(points_tuple) pass @@ -200,6 +194,5 @@ def _device_assertions( for t in tensors: if not t.device == leading.device: raise ValueError( - "Ensure that all tensors passed to FINUFFT are on the same " - "device" + "Ensure that all tensors passed to FINUFFT are on the same " "device" ) diff --git a/pytorch_finufft/functional.py b/pytorch_finufft/functional.py index e59586f..4f1c9f6 100644 --- a/pytorch_finufft/functional.py +++ b/pytorch_finufft/functional.py @@ -81,7 +81,7 @@ def forward( if finufftkwargs is None: finufftkwargs = dict() - + finufftkwargs = {k: v for k, v in finufftkwargs.items()} _mode_ordering = finufftkwargs.pop("modeord", 1) _i_sign = finufftkwargs.pop("isign", -1) @@ -140,13 +140,14 @@ def backward( if ctx.needs_input_grad[0]: # w.r.t. the points x_j - k_ramp = torch.arange( - 0, grad_output.shape[-1], dtype=points.dtype - ) - (grad_output.shape[-1] // 2) + k_ramp = torch.arange(0, grad_output.shape[-1], dtype=points.dtype) - ( + grad_output.shape[-1] // 2 + ) if _mode_ordering != 0: k_ramp = torch.fft.ifftshift(k_ramp) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_grad_output = k_ramp * grad_output * 1j * _i_sign np_points = (points.data).numpy() @@ -311,7 +312,8 @@ def backward( if _mode_ordering != 0: k_ramp = torch.fft.ifftshift(k_ramp) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_targets = k_ramp * targets * 1j * _i_sign np_points = (points.data).numpy() @@ -545,7 +547,8 @@ def forward( # to note instead that there is a conflict in fftshift if _mode_ordering != 1: raise ValueError( - "Double specification of ordering; only one of fftshift and modeord should be provided" + "Double specification of ordering; only one of fftshift and " + "modeord should be provided" ) _mode_ordering = 0 @@ -608,7 +611,8 @@ def backward( if _mode_ordering != 0: XX = torch.fft.ifftshift(XX) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_grad_output = XX * grad_output * 1j * _i_sign np_points_x = points_x.data.numpy() @@ -634,7 +638,8 @@ def backward( if _mode_ordering != 0: YY = torch.fft.ifftshift(YY) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_grad_output = YY * grad_output * 1j * _i_sign np_points_x = points_x.data.numpy() @@ -747,7 +752,8 @@ def forward( if fftshift: if _mode_ordering != 1: raise ValueError( - "Double specification of ordering; only one of fftshift and modeord should be provided." + "Double specification of ordering; only one of fftshift and " + "modeord should be provided." ) _mode_ordering = 0 @@ -816,7 +822,8 @@ def backward( if _mode_ordering != 0: XX = torch.fft.ifftshift(XX) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_targets = XX * targets * 1j * _i_sign np_points_x = points_x.data.numpy() @@ -845,7 +852,8 @@ def backward( if _mode_ordering != 0: YY = torch.fft.ifftshift(YY) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_targets = YY * targets * 1j * _i_sign np_points_x = points_x.data.numpy() @@ -1059,7 +1067,8 @@ def forward( # to note instead that there is a conflict in fftshift if _mode_ordering != 1: raise ValueError( - "Double specification of ordering; only one of fftshift and modeord should be provided" + "Double specification of ordering; only one of fftshift and " + "modeord should be provided" ) _mode_ordering = 0 @@ -1128,7 +1137,8 @@ def backward( if _mode_ordering != 0: XX = torch.fft.ifftshift(XX) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_grad_output = XX * grad_output * 1j * _i_sign np_points_x = points_x.data.numpy() @@ -1154,7 +1164,8 @@ def backward( if _mode_ordering != 0: YY = torch.fft.ifftshift(YY) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_grad_output = YY * grad_output * 1j * _i_sign np_points_x = points_x.data.numpy() @@ -1180,7 +1191,8 @@ def backward( if _mode_ordering != 0: ZZ = torch.fft.ifftshift(ZZ) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_grad_output = ZZ * grad_output * 1j * _i_sign np_points_x = points_x.data.numpy() @@ -1373,7 +1385,8 @@ def backward( if _mode_ordering != 0: XX = torch.fft.ifftshift(XX) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_targets = XX * targets * 1j * _i_sign np_points_x = points_x.data.numpy() @@ -1400,7 +1413,8 @@ def backward( if _mode_ordering != 0: YY = torch.fft.ifftshift(YY) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_targets = YY * targets * 1j * _i_sign np_points_x = points_x.data.numpy() @@ -1427,7 +1441,8 @@ def backward( if _mode_ordering != 0: ZZ = torch.fft.ifftshift(ZZ) - # TODO analytically work out if we can simplify this *1j, the below conj, and below *values + # TODO analytically work out if we can simplify this *1j, + # the below conj, and below *values ramped_targets = ZZ * targets * 1j * _i_sign np_points_x = points_x.data.numpy() diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index a60a0ec..0000000 --- a/requirements.txt +++ /dev/null @@ -1,11 +0,0 @@ -filelock==3.12.1 ; python_version >= "3.9" and python_version < "3.12" -finufft==2.1.0 ; python_version >= "3.9" and python_version < "3.12" -jinja2==3.1.2 ; python_version >= "3.9" and python_version < "3.12" -markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "3.12" -mpmath==1.3.0 ; python_version >= "3.9" and python_version < "3.12" -networkx==3.1 ; python_version >= "3.9" and python_version < "3.12" -numpy==1.24.3 ; python_version >= "3.9" and python_version < "3.12" -scipy==1.10.1 ; python_version >= "3.9" and python_version < "3.12" -sympy==1.12 ; python_version >= "3.9" and python_version < "3.12" -torch==2.0.1 ; python_version >= "3.9" and python_version < "3.12" -typing-extensions==4.6.3 ; python_version >= "3.9" and python_version < "3.12" diff --git a/tests/test_1d/test_backward_1d.py b/tests/test_1d/test_backward_1d.py index 0a304f5..93971b7 100644 --- a/tests/test_1d/test_backward_1d.py +++ b/tests/test_1d/test_backward_1d.py @@ -84,9 +84,7 @@ def test_t1_backward_CPU_points( inputs = (points, values) - assert gradcheck( - apply_finufft1d1(modifier, fftshift, isign), inputs, atol=1e-4 * N - ) + assert gradcheck(apply_finufft1d1(modifier, fftshift, isign), inputs, atol=1e-4 * N) # Case generation for the values tests diff --git a/tests/test_1d/test_forward_1d.py b/tests/test_1d/test_forward_1d.py index b476489..365a082 100644 --- a/tests/test_1d/test_forward_1d.py +++ b/tests/test_1d/test_forward_1d.py @@ -26,12 +26,10 @@ cases = [torch.tensor([1.0, 2.5, -1.0, -1.5, 1.5], dtype=torch.complex128)] for n in Ns: cases.append( - torch.randn(n, dtype=torch.float64) - + 1j * torch.randn(n, dtype=torch.float64) + torch.randn(n, dtype=torch.float64) + 1j * torch.randn(n, dtype=torch.float64) ) cases.append( - torch.randn(n, dtype=torch.float32) - + 1j * torch.randn(n, dtype=torch.float32) + torch.randn(n, dtype=torch.float32) + 1j * torch.randn(n, dtype=torch.float32) ) @@ -48,9 +46,7 @@ def test_1d_t1_forward_CPU(values: torch.Tensor) -> None: against_torch = torch.fft.fft(values) against_scipy = torch.tensor(scipy.fft.fft(val_np)) - data_type = ( - torch.float64 if values.dtype is torch.complex128 else torch.float32 - ) + data_type = torch.float64 if values.dtype is torch.complex128 else torch.float32 finufft1D1_out = pytorch_finufft.functional.finufft1D1.apply( 2 * np.pi * torch.arange(0, 1, 1 / N, dtype=data_type), @@ -83,9 +79,7 @@ def test_1d_t2_forward_CPU(targets: torch.Tensor): against_torch = torch.fft.ifft(inv_targets) - data_type = ( - torch.float64 if targets.dtype is torch.complex128 else torch.float32 - ) + data_type = torch.float64 if targets.dtype is torch.complex128 else torch.float32 finufft_out = ( pytorch_finufft.functional.finufft1D2.apply( @@ -95,9 +89,9 @@ def test_1d_t2_forward_CPU(targets: torch.Tensor): / N ) - assert torch.norm( - finufft_out - np.array(targets) - ) / N**2 == pytest.approx(0, abs=1e-05) + assert torch.norm(finufft_out - np.array(targets)) / N**2 == pytest.approx( + 0, abs=1e-05 + ) assert torch.norm(finufft_out - against_torch) / N**2 == pytest.approx( 0, abs=1e-05 ) diff --git a/tests/test_2d/test_backward_2d.py b/tests/test_2d/test_backward_2d.py index 83b75bb..ce7122a 100644 --- a/tests/test_2d/test_backward_2d.py +++ b/tests/test_2d/test_backward_2d.py @@ -121,9 +121,7 @@ def test_t1_backward_CPU_points_x( inputs = (points_x, points_y, values) - assert gradcheck( - apply_finufft2d1(modifier, fftshift, isign), inputs, atol=1e-4 * N - ) + assert gradcheck(apply_finufft2d1(modifier, fftshift, isign), inputs, atol=1e-4 * N) @pytest.mark.parametrize("N", Ns) @@ -149,9 +147,7 @@ def test_t1_backward_CPU_points_y( inputs = (points_x, points_y, values) - assert gradcheck( - apply_finufft2d1(modifier, fftshift, isign), inputs, atol=1e-4 * N - ) + assert gradcheck(apply_finufft2d1(modifier, fftshift, isign), inputs, atol=1e-4 * N) ###################################################################### diff --git a/tests/test_3d/test_forward_3d.py b/tests/test_3d/test_forward_3d.py index 703d9a6..175e6af 100644 --- a/tests/test_3d/test_forward_3d.py +++ b/tests/test_3d/test_forward_3d.py @@ -44,9 +44,9 @@ def test_3d_t1_forward_CPU(N: int) -> None: against_torch = torch.fft.fftn(values.reshape(g[0].shape)) - assert abs((finufft_out - against_torch).sum()) / ( - N**4 - ) == pytest.approx(0, abs=1e-6) + assert abs((finufft_out - against_torch).sum()) / (N**4) == pytest.approx( + 0, abs=1e-6 + ) @pytest.mark.parametrize("N", Ns) @@ -72,6 +72,6 @@ def test_3d_t2_forward_CPU(N: int) -> None: against_torch = torch.fft.ifftn(values) - assert (abs((finufft_out - against_torch).sum())) / ( - N**4 - ) == pytest.approx(0, abs=1e-6) + assert (abs((finufft_out - against_torch).sum())) / (N**4) == pytest.approx( + 0, abs=1e-6 + ) From 8cef09fb06cd9894eccba8f46d40d193c9723995 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Wed, 4 Oct 2023 11:18:21 -0400 Subject: [PATCH 3/6] Fix some lints MyPy might be a bad choice for this repo --- .github/workflows/lint.yml | 9 +++-- .github/workflows/test.yml | 5 ++- pyproject.toml | 5 ++- pytorch_finufft/__init__.py | 1 - pytorch_finufft/_err.py | 20 +++++------ pytorch_finufft/functional.py | 66 +++++++++++++++++------------------ pytorch_finufft/py.typed | 0 7 files changed, 55 insertions(+), 51 deletions(-) create mode 100644 pytorch_finufft/py.typed diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 177b74c..0463176 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,9 +25,12 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install ruff mypy - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install -e . + pip install -e .[dev] + + - name: Check formatting + run: | + isort --check . + black --check . - name: Lint with ruff run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index afe3156..b4a2449 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,9 +29,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest - pip install . + pip install .[dev] - name: Pytest run: | - pytest tests/ + pytest tests/ --cov diff --git a/pyproject.toml b/pyproject.toml index 7d0a92d..2b16df7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ repository = "https://github.com/flatironinstitute/pytorch-finufft" homepage = "https://github.com/flatironinstitute/pytorch-finufft" [project.optional-dependencies] -dev = ["black", "mypy", "isort", "ruff", "pytest"] +dev = ["black", "mypy", "isort", "ruff", "pytest", "pytest-cov"] [tool.setuptools.dynamic] version = { attr = "pytorch_finufft.__version__" } @@ -37,6 +37,9 @@ version = { attr = "pytorch_finufft.__version__" } [tool.setuptools.packages] find = {} +[tool.setuptools.package-data] +"pytorch_finufft" = ["py.typed"] + [tool.black] target-version = ["py39"] line-length = 88 diff --git a/pytorch_finufft/__init__.py b/pytorch_finufft/__init__.py index 64cbff2..8a4bbf5 100644 --- a/pytorch_finufft/__init__.py +++ b/pytorch_finufft/__init__.py @@ -1,4 +1,3 @@ -# type: ignore[attr-defined] """Pytorch bindings for the FINUFFT Library""" from . import functional, nn diff --git a/pytorch_finufft/_err.py b/pytorch_finufft/_err.py index c2116d7..26924bc 100644 --- a/pytorch_finufft/_err.py +++ b/pytorch_finufft/_err.py @@ -1,4 +1,4 @@ -from typing import Union +from typing import Union, Tuple import torch @@ -13,20 +13,20 @@ def _type1_checks( - points_tuple: tuple[torch.Tensor, ...], + points_tuple: Tuple[torch.Tensor, ...], values: torch.Tensor, - output_shape: Union[int, tuple[int, ...]], + output_shape: Union[int, Tuple[int, ...]], ) -> None: """ TODO Parameters ---------- - points_tuple : tuple[torch.Tensor, ...] + points_tuple : Tuple[torch.Tensor, ...] Tuples of points inputs, eg, (points,) or (points_x, points_y) values : torch.Tensor Values tensor - output_shape : Union[int, tuple[int, ...]] + output_shape : Union[int, Tuple[int, ...]] Output shape either from the in-place array or directly passed Raises @@ -98,7 +98,7 @@ def _type1_checks( def _type2_checks( - points_tuple: tuple[torch.Tensor, ...], targets: torch.Tensor + points_tuple: Tuple[torch.Tensor, ...], targets: torch.Tensor ) -> None: """ Performs all type, precision, size, device, ... checks for the @@ -158,9 +158,9 @@ def _type2_checks( def _type3_checks( - points_tuple: tuple[torch.Tensor, ...], + points_tuple: Tuple[torch.Tensor, ...], values: torch.Tensor, - targets_tuple: tuple[torch.Tensor, ...], + targets_tuple: Tuple[torch.Tensor, ...], ) -> None: # raise ValueError("Not yet implemented!") @@ -170,7 +170,7 @@ def _type3_checks( def _device_assertions( - leading: torch.Tensor, tensors: tuple[torch.Tensor, ...] + leading: torch.Tensor, tensors: Tuple[torch.Tensor, ...] ) -> None: """ Asserts that all inputs are on the same device by checking against that @@ -181,7 +181,7 @@ def _device_assertions( leading : torch.Tensor The tensor against which the device of each tensor in tensors should be checked against - tensors : tuple[torch.Tensor, ...] + tensors : Tuple[torch.Tensor, ...] The remaining tensors to check Raises diff --git a/pytorch_finufft/functional.py b/pytorch_finufft/functional.py index 4f1c9f6..f64a61b 100644 --- a/pytorch_finufft/functional.py +++ b/pytorch_finufft/functional.py @@ -2,7 +2,7 @@ Implementations of the corresponding Autograd functions """ -from typing import Any, Optional, Union +from typing import Any, Optional, Union, Tuple, Dict import finufft import torch @@ -27,7 +27,7 @@ def forward( output_shape: int, out: Optional[torch.Tensor] = None, fftshift: bool = False, - finufftkwargs: dict[str, Union[int, float]] = None, + finufftkwargs: Dict[str, Union[int, float]] = None, ) -> torch.Tensor: """ Evaluates the Type 1 NUFFT on the inputs. @@ -58,7 +58,7 @@ def forward( Array to populate with result in-place, by default None fftshift : bool If True centers the 0 mode in the resultant array, by default False - finufftkwargs : dict[str, Union[int, float]] + finufftkwargs : Dict[str, Union[int, float]] Additional arguments will be passed into FINUFFT. See https://finufft.readthedocs.io/en/latest/python.html. By default an empty dictionary @@ -114,7 +114,7 @@ def forward( @staticmethod def backward( ctx: Any, grad_output: torch.Tensor - ) -> tuple[Union[torch.Tensor, None], ...]: + ) -> Tuple[Union[torch.Tensor, None], ...]: """ Implements derivatives wrt. each argument in the forward method. @@ -198,7 +198,7 @@ def forward( targets: torch.Tensor, out: Optional[torch.Tensor] = None, fftshift: bool = False, - finufftkwargs: dict[str, Union[int, float]] = {}, + finufftkwargs: Dict[str, Union[int, float]] = {}, ) -> torch.Tensor: """ Evaluates the Type 2 NUFFT on the inputs. @@ -226,7 +226,7 @@ def forward( Array to take the result in-place, by default None fftshift : bool If True centers the 0 mode in the resultant array, by default False - finufftkwargs : dict[str, Union[int, float]] + finufftkwargs : Dict[str, Union[int, float]] Additional arguments will be passed into FINUFFT. See https://finufft.readthedocs.io/en/latest/python.html. By default an empty dictionary @@ -279,7 +279,7 @@ def forward( @staticmethod def backward( ctx: Any, grad_output: torch.Tensor - ) -> tuple[Union[torch.Tensor, None], ...]: + ) -> Tuple[Union[torch.Tensor, None], ...]: """ Implements derivatives wrt. each argument in the forward method @@ -364,7 +364,7 @@ def forward( values: torch.Tensor, targets: torch.Tensor, out: Optional[torch.Tensor] = None, - finufftkwargs: dict[str, Union[int, float]] = {}, + finufftkwargs: Dict[str, Union[int, float]] = {}, ) -> torch.Tensor: """ Evaluates the Type 3 NUFFT on the inputs. @@ -389,7 +389,7 @@ def forward( The non-uniform target points s_k. out : Optional[torch.Tensor] Array to populate with result in-place, by default None - finufftkwargs : dict[str, Union[int, float]] + finufftkwargs : Dict[str, Union[int, float]] Additional arguments will be passed into FINUFFT. See https://finufft.readthedocs.io/en/latest/python.html. By default an empty dictionary @@ -427,7 +427,7 @@ def forward( @staticmethod def backward( ctx: Any, grad_output: torch.Tensor - ) -> tuple[Union[torch.Tensor, Any], ...]: + ) -> Tuple[Union[torch.Tensor, Any], ...]: """ Implements gradients for backward mode automatic differentation @@ -476,10 +476,10 @@ def forward( points_x: torch.Tensor, points_y: torch.Tensor, values: torch.Tensor, - output_shape: Union[int, tuple[int, int]], + output_shape: Union[int, Tuple[int, int]], out: Optional[torch.Tensor] = None, fftshift: bool = False, - finufftkwargs: dict[str, Union[int, float]] = {}, + finufftkwargs: Dict[str, Union[int, float]] = {}, ) -> torch.Tensor: """ Evaluates the Type 1 NUFFT on the inputs. @@ -506,7 +506,7 @@ def forward( The non-uniform points y_j. Valid only between -3pi and 3pi values : torch.Tensor The source strengths c_j. - output_shape : Union[int, tuple[int, int]] + output_shape : Union[int, Tuple[int, int]] Number of Fourier modes to use in the computation (which coincides with the dimensions of the resultant array). If just an integer is provided, rather than a 2-tuple, then the integer @@ -515,7 +515,7 @@ def forward( Array to populate with result in-place, by default None fftshift : bool If True centers the 0 mode in the resultant array, by default False - finufftkwargs : dict[str, Union[int, float]] + finufftkwargs : Dict[str, Union[int, float]] Additional arguments will be passed into FINUFFT. See https://finufft.readthedocs.io/en/latest/python.html. By default an empty dictionary @@ -573,7 +573,7 @@ def forward( @staticmethod def backward( ctx: Any, grad_output: torch.Tensor - ) -> tuple[Union[torch.Tensor, None], ...]: + ) -> Tuple[Union[torch.Tensor, None], ...]: """ Implements derivatives wrt. each argument in the forward method. @@ -692,7 +692,7 @@ def forward( targets: torch.Tensor, out: Optional[torch.Tensor] = None, fftshift: bool = False, - finufftkwargs: dict[str, Union[int, float]] = {}, + finufftkwargs: Dict[str, Union[int, float]] = {}, ) -> torch.Tensor: """ Evaluates the Type 2 NUFFT on the inputs. @@ -723,7 +723,7 @@ def forward( Array to take the result in-place, by default None fftshift : bool If True centers the 0 mode in the resultant torch.Tensor, by default False - finufftkwargs : dict[str, Union[int, float]] + finufftkwargs : Dict[str, Union[int, float]] Additional arguments will be passed into FINUFFT. See https://finufft.readthedocs.io/en/latest/python.html. By default an empty dictionary @@ -778,7 +778,7 @@ def forward( @staticmethod def backward( ctx: Any, grad_output: torch.Tensor - ) -> tuple[ + ) -> Tuple[ Union[torch.Tensor, None], Union[torch.Tensor, None], Union[torch.Tensor, None], @@ -798,7 +798,7 @@ def backward( Returns ------- - tuple[ Union[torch.Tensor, None], ...] + Tuple[ Union[torch.Tensor, None], ...] A tuple of derivatives wrt. each argument in the forward method """ _i_sign = ctx.isign @@ -957,7 +957,7 @@ def forward( @staticmethod def backward( ctx: Any, grad_output: torch.Tensor - ) -> tuple[Union[torch.Tensor, None], ...]: + ) -> Tuple[Union[torch.Tensor, None], ...]: """ Implements gradients for backward mode automatic differentiation @@ -970,7 +970,7 @@ def backward( Returns ------- - tuple[Union[torch.Tensor, None], ...] + Tuple[Union[torch.Tensor, None], ...] Tuple of derivatives with respect to each input """ @@ -994,10 +994,10 @@ def forward( points_y: torch.Tensor, points_z: torch.Tensor, values: torch.Tensor, - output_shape: Union[int, tuple[int, int]], + output_shape: Union[int, Tuple[int, int]], out: Optional[torch.Tensor] = None, fftshift: bool = False, - finufftkwargs: dict[str, Union[int, float]] = {}, + finufftkwargs: Dict[str, Union[int, float]] = {}, ) -> torch.Tensor: """ Evaluates the Type 1 NUFFT on the inputs. @@ -1026,7 +1026,7 @@ def forward( The non-uniform points z_j. Valid only between -3pi and 3pi. values : torch.Tensor The source strengths c_j. - output_shape : Union[int, tuple[int, int, int]] + output_shape : Union[int, Tuple[int, int, int]] The number of Fourier modes to use in the computation (which coincides with the length of the resultant array in each corresponding direction). If only an integer is provided @@ -1036,7 +1036,7 @@ def forward( Array to populate with result in-place, by default None fftshift : bool If True centers the 0 mode in the resultant array, by default False - finufftkwargs : dict[str, Union[int, float]] + finufftkwargs : Dict[str, Union[int, float]] Additional arguments will be passed into FINUFFT. See https://finufft.readthedocs.io/en/latest/python.html. By default an empty dictionary @@ -1096,7 +1096,7 @@ def forward( @staticmethod def backward( ctx: Any, grad_output: torch.Tensor - ) -> tuple[Union[torch.Tensor, None], ...]: + ) -> Tuple[Union[torch.Tensor, None], ...]: """ Implements derivatives wrt. each argument in the forward method. @@ -1109,7 +1109,7 @@ def backward( Returns ------- - tuple[Union[torch.Tensor, None], ...] + Tuple[Union[torch.Tensor, None], ...] A tuple of derivatives wrt. each argument in the forward method """ _i_sign = -1 * ctx.isign @@ -1258,7 +1258,7 @@ def forward( targets: torch.Tensor, out: Optional[torch.Tensor] = None, fftshift: bool = False, - finufftkwargs: dict[str, Union[int, float]] = {}, + finufftkwargs: Dict[str, Union[int, float]] = {}, ) -> torch.Tensor: """ Evalutes the Type 2 NUFFT on the inputs @@ -1290,7 +1290,7 @@ def forward( Array to use for in-place result, by default None fftshift : bool If True centers the 0 mode in the resultant array, by default False - finufftkwargs : dict[str, Union[int, float]] + finufftkwargs : Dict[str, Union[int, float]] Additional arguments will be passed into FINUFFT. See https://finufft.readthedocs.io/en/latest/python.html. By default an empty dictionary @@ -1345,7 +1345,7 @@ def forward( @staticmethod def backward( ctx: Any, grad_output: torch.Tensor - ) -> tuple[Union[torch.Tensor, None], ...]: + ) -> Tuple[Union[torch.Tensor, None], ...]: """ Implements derivatives wrt. each argument in the forward method @@ -1358,7 +1358,7 @@ def backward( Returns ------- - tuple[Union[torch.Tensor, None], ...] + Tuple[Union[torch.Tensor, None], ...] Tuple of derivatives wrt. each argument in the forward method """ _i_sign = ctx.isign @@ -1558,7 +1558,7 @@ def forward( @staticmethod def backward( ctx: Any, grad_output: torch.Tensor - ) -> tuple[Union[torch.Tensor, None], ...]: + ) -> Tuple[Union[torch.Tensor, None], ...]: """ Implements gradients for backward mode automatic differentiation @@ -1571,7 +1571,7 @@ def backward( Returns ------- - tuple[Union[torch.Tensor, None], ...] + Tuple[Union[torch.Tensor, None], ...] Tuple of derivatives with respect to each input """ diff --git a/pytorch_finufft/py.typed b/pytorch_finufft/py.typed new file mode 100644 index 0000000..e69de29 From 28ff8b0dc7311fbde6850483e0e803309ec67420 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Wed, 4 Oct 2023 11:20:57 -0400 Subject: [PATCH 4/6] Don't fail-fast --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b4a2449..4fcbc91 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,7 @@ jobs: strategy: matrix: python-version: ["3.9", "3.10", "3.11"] + fail-fast: false steps: - uses: actions/checkout@v3 From 0ded7a58906743f737c44beec27efd0b98bce37e Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Wed, 4 Oct 2023 11:23:23 -0400 Subject: [PATCH 5/6] isort --- pytorch_finufft/_err.py | 2 +- pytorch_finufft/functional.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pytorch_finufft/_err.py b/pytorch_finufft/_err.py index 26924bc..bb6de3e 100644 --- a/pytorch_finufft/_err.py +++ b/pytorch_finufft/_err.py @@ -1,4 +1,4 @@ -from typing import Union, Tuple +from typing import Tuple, Union import torch diff --git a/pytorch_finufft/functional.py b/pytorch_finufft/functional.py index f64a61b..96551b5 100644 --- a/pytorch_finufft/functional.py +++ b/pytorch_finufft/functional.py @@ -2,7 +2,7 @@ Implementations of the corresponding Autograd functions """ -from typing import Any, Optional, Union, Tuple, Dict +from typing import Any, Dict, Optional, Tuple, Union import finufft import torch From 658da5dfb5968db7f2e33704762ad3444976b16c Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Wed, 4 Oct 2023 11:23:56 -0400 Subject: [PATCH 6/6] Remove unused imports --- tests/test_1d/test_forward_1d.py | 1 - tests/test_2d/test_forward_2d.py | 1 - tests/test_3d/test_forward_3d.py | 3 --- 3 files changed, 5 deletions(-) diff --git a/tests/test_1d/test_forward_1d.py b/tests/test_1d/test_forward_1d.py index 365a082..1bbd8d0 100644 --- a/tests/test_1d/test_forward_1d.py +++ b/tests/test_1d/test_forward_1d.py @@ -2,7 +2,6 @@ import pytest import scipy import torch -from numpy.testing import assert_almost_equal import pytorch_finufft diff --git a/tests/test_2d/test_forward_2d.py b/tests/test_2d/test_forward_2d.py index a4518d7..3a61938 100644 --- a/tests/test_2d/test_forward_2d.py +++ b/tests/test_2d/test_forward_2d.py @@ -1,4 +1,3 @@ -import finufft import numpy as np import pytest import torch diff --git a/tests/test_3d/test_forward_3d.py b/tests/test_3d/test_forward_3d.py index 175e6af..e470abc 100644 --- a/tests/test_3d/test_forward_3d.py +++ b/tests/test_3d/test_forward_3d.py @@ -1,9 +1,6 @@ -import finufft import numpy as np import pytest -import scipy import torch -from numpy.random import standard_normal import pytorch_finufft