Skip to content

Fix SliceDataset NumPy copy protocol - #1170

Closed
Ganesh1729-ui wants to merge 1 commit into
skorch-dev:masterfrom
Ganesh1729-ui:fix/1169-slicedataset-copy-protocol
Closed

Ganesh1729-ui wants to merge 1 commit into
skorch-dev:masterfrom
Ganesh1729-ui:fix/1169-slicedataset-copy-protocol

Conversation

@Ganesh1729-ui

@Ganesh1729-ui Ganesh1729-ui commented Oct 13, 2026 •

Copy link
Copy Markdown

Closes #1169.

Change

Accept copy=None in SliceDataset.__array__ following the
NumPy migration guide.
Materialization allocates an independent array for copy=True/None;
copy=False raises ValueError before reading items.

Add 32 cases for NumPy/Torch vectors/scalars, dtypes, memory independence and
rejection, plus a changelog entry. Protocol deprecations are errors in these tests.

Validation

  • New tests on unchanged source: 24 fail / 8 pass.
  • Windows/Python 3.13/NumPy 2.5.4/Torch 2.14 CPU suite: baseline 1,128 pass;
    fixed 1,160 pass, 160 skip, 46 deselect, 1 xfail, with unchanged 45 warnings
    and existing L-BFGS retries.
  • Own-fork Linux validation:
    NumPy2 CPU 1,132 → 1,164 passes; NumPy1 affected modules 397 → 409
    passes
    , 24 → 44 skips. A broader NumPy1 run stops at unchanged upstream's
    L-BFGS failure before testing the fix. Windows NumPy1 retains 21 baseline
    dtype failures (376 → 388 passes).
  • Pylint/Flake8 retain 101/2 baseline diagnostics. Wheel/sdist build and 24
    installed-wheel conversions plus early rejection pass.

HF/LLM, distributed, GPU and the full matrix were not run. Six checkpoint/compile
cases are excluded for previously reproduced Windows path/MSVC limitations.
Existing empty-dataset PR #1168 remains separate.

AI assisted investigation, implementation and testing; no human review is claimed.

@Ganesh1729-ui

Copy link
Copy Markdown
Author

Additional validation summary for 04b06c64: own-fork Linux run passes both jobs. NumPy 2's available CPU suite goes from 1,132 baseline passes to 1,164 fixed passes. NumPy 1's affected modules go from 397 to 409 passes, with the expected version-specific skips documented.

The added cases fail 24/32 before the fix, with eight controls already passing. copy=False raises before reading dataset items; True/None preserve independent conversion. Windows, wheel and baseline lint limitations remain in the description. The validation workflow is confined to a separate fork branch. Upstream test approval is pending.

@Ganesh1729-ui

Copy link
Copy Markdown
Author

Follow-up for review: this aligns SliceDataset.array with the NumPy copy protocol. copy=None and copy=True materialize independently, while copy=False fails before reading items. The 32 focused regressions distinguish the cases; available cross-version validations are recorded in the PR.

@Ganesh1729-ui

Copy link
Copy Markdown
Author

CI follow-up for 04b06c64: the tests run is still action_required, awaiting maintainer approval.

The NumPy copy-protocol cases and the separate NumPy 1/2 fork validation are linked above. Please approve the upstream test workflow when ready; those fork results are separate from this blocked upstream run.

@BenjaminBossan

Copy link
Copy Markdown
Collaborator

Thanks for the PR. As maintainers of skorch, we decided to update the status of the skorch project. As a consequence, we will close this PR. Your effort is still appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SliceDataset NumPy 2 copy=True conversion emits a protocol deprecation warning

2 participants