Skip to content

[Bug] Rust-backed QDP file loader ignores the configured batch limit #1468

Description

@viiccwen

What

QuantumDataLoader.batches(total, size) documents total as the maximum number of batches emitted for file sources. The Rust-backed file loader ignores that value and consumes the entire file because the Python wrapper always passes batch_limit=None to the native loader.

Steps to reproduce:

import numpy as np
from qumat_qdp import QuantumDataLoader

np.save("vectors.npy", np.eye(4, dtype=np.float64))

loader = (
    QuantumDataLoader()
    .backend("rust")
    .qubits(2)
    .batches(1, size=2)
    .source_file("vectors.npy")
)

print(len(list(loader)))

Actual result:

2

Expected result:

1

Iteration should never emit more than the configured number of batches for file-backed sources.

Environment

  • OS: Linux
  • Python version: 3.12.12
  • Qumat version: 0.7.0.dev0 (qumat-qdp 0.3.0.dev0)
  • GPU: NVIDIA GeForce RTX 4090

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions