Skip to content
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
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,8 @@ bindings.
layer wraps them so every function accepts numpy arrays and **returns a fresh
numpy array** (inputs untouched unless `inplace=True`).
- Adds validation, zero-copy batch broadcasting, and output allocation.
- Depends only on `fastfields-dlpack` + numpy.
- Depends on `fastfields-dlpack` (compiled bindings) + `fastfields-helpers`
(the `Spline`/`Bound` enums and argument normalisers) + numpy.

## Exposed capabilities (feature level)
- **Distance**: `dt_euclidean`, `dt_l1` (along
Expand Down
2 changes: 1 addition & 1 deletion fastfields/numpy/__init__.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@

from __future__ import annotations

from fastfields.dlpack import Bound, Spline
from fastfields.helpers import Bound, Spline

from ._dt import (
dt_euclidean,
Expand Down
4 changes: 2 additions & 2 deletions fastfields/numpy/_resample.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@
from typing import Sequence

import fastfields.dlpack as _ff
from fastfields.dlpack import (
from fastfields.helpers import (
anchor_scale_shift,
infer_ndim,
resolve_out_spatial,
Expand DownExpand Up@@ -82,7 +82,7 @@ def _resize_shapes(
"""Return the batch, input-spatial, and output-spatial shapes.

The output spatial shape is resolved via
:func:`fastfields.dlpack.resolve_out_spatial` so every backend shares one
:func:`fastfields.helpers.resolve_out_spatial` so every backend shares one
implementation. Raises ``ValueError`` if ``factor``/``shape`` do not have
length ``ndim``.
"""
Expand Down
6 changes: 3 additions & 3 deletions fastfields/numpy/_util.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,11 +9,11 @@

from typing import Any

# `order`/`bound` normalisation is centralised in fastfields.dlpack so
# `order`/`bound` normalisation is centralised in fastfields.helpers so
# every backend shares one implementation; re-export under the private
# names the numpy modules (_dt, _resample) already import.
from fastfields.dlpack import as_bound as _as_bound # noqa: F401
from fastfields.dlpack import as_spline as _as_spline # noqa: F401
from fastfields.helpers import as_bound as _as_bound # noqa: F401
from fastfields.helpers import as_spline as _as_spline # noqa: F401

import numpy as np

Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,8 +41,13 @@ classifiers = [
# (fires when `git describe` can't find a tag, e.g. a shallow-clone CI
# misconfiguration) would also satisfy `==0.*` if it were ever accidentally
# published. That's an accepted risk, not something this pin tries to solve.
# fastfields-helpers is the pure-Python enums/normalisation package this
# wrapper's argument handling is built on (fastfields.helpers.Bound/Spline/
# as_bound/...) -- same bare-wildcard convention as fastfields-dlpack above,
# for the same reason: it moves on the same 0.x line.
dependencies = [
"fastfields-dlpack==0.*",
"fastfields-helpers==0.*",
"numpy",
]

Expand Down
4 changes: 2 additions & 2 deletions tests/test_numpy.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -647,7 +647,7 @@ def test_restriction_runs_and_shapes():


def test_anchor_scale_shift_mapping():
from fastfields.dlpack import anchor_scale_shift as _anchor_scale_shift
from fastfields.helpers import anchor_scale_shift as _anchor_scale_shift

# 8 -> 4 downsample; scale/shift per torch-interpol convention.
for name, abbr, exp_scale, exp_shift in [
Expand All@@ -664,7 +664,7 @@ def test_anchor_scale_shift_mapping():


def test_anchor_unknown_raises():
from fastfields.dlpack import anchor_scale_shift as _anchor_scale_shift
from fastfields.helpers import anchor_scale_shift as _anchor_scale_shift

with pytest.raises(ValueError, match="anchor"):
_anchor_scale_shift("nope", (8,), (4,), 1)
Expand Down
Loading