Skip to content

[Type Tensor 1: Add qd.Backend IntEnum#521

Draft
hughperkins wants to merge 3 commits intomainfrom
hp/tensor-stork-1
Draft

[Type Tensor 1: Add qd.Backend IntEnum#521
hughperkins wants to merge 3 commits intomainfrom
hp/tensor-stork-1

Conversation

@hughperkins
Copy link
Copy Markdown
Collaborator

First step of the flexible-tensors series (hp/tensor-stork-N): introduce a Backend IntEnum with FIELD=0 and NDARRAY=1 that subsequent PRs will use to drive a per-tensor backend choice on the upcoming qd.tensor() factory.

This PR ships the enum only — no factory, no layout, no kernel integration.

Adds:

  • python/quadrants/_flexible.py with the Backend IntEnum.
  • Re-export through quadrants/init.py so users access it as qd.Backend.
  • tests/python/test_flexible_backend.py covering symbol export, IntEnum semantics, lookup by name/value, distinct members, and rejection of invalid values.
  • docs/source/user_guide/flexible_tensors.md seeded with a one-section user-facing description of qd.Backend, registered in the Core Concepts toctree of user_guide/index.md.

Tests pass locally; sphinx make html succeeds with no new warnings on the flexible_tensors.md page.

Issue: #

Brief Summary

copilot:summary

Walkthrough

copilot:walkthrough

First step of the flexible-tensors series (hp/tensor-stork-N): introduce a
Backend IntEnum with FIELD=0 and NDARRAY=1 that subsequent PRs will use to
drive a per-tensor backend choice on the upcoming qd.tensor() factory.

This PR ships the enum only — no factory, no layout, no kernel integration.

Adds:
- python/quadrants/_flexible.py with the Backend IntEnum.
- Re-export through quadrants/__init__.py so users access it as qd.Backend.
- tests/python/test_flexible_backend.py covering symbol export, IntEnum
  semantics, lookup by name/value, distinct members, and rejection of
  invalid values.
- docs/source/user_guide/flexible_tensors.md seeded with a one-section
  user-facing description of qd.Backend, registered in the Core Concepts
  toctree of user_guide/index.md.

Tests pass locally; sphinx make html succeeds with no new warnings on the
flexible_tensors.md page.
@hughperkins hughperkins changed the title [FlexibleTensors] PR 1: Add qd.Backend IntEnum [Type Tensor 1: Add qd.Backend IntEnum Apr 20, 2026
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just call this tensor.md?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_tensor.py?

Comment thread python/quadrants/_flexible.py Outdated
@@ -0,0 +1,33 @@
"""Flexible tensors: per-tensor backend and (later) layout.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Flexible tensors" => "Tensor"

import quadrants as qd


def test_backend_is_exported():
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a lot of tests for a simple enum, but .... 🤷

@hughperkins hughperkins force-pushed the hp/tensor-stork-1 branch 2 times, most recently from ac53459 to 1b65811 Compare April 20, 2026 20:59
Drops the 'flexible' prefix from filenames and identifiers introduced
in this branch series so the user-visible names are simply 'tensor'.
Also strips PR-N back-references that will be meaningless once these
PRs land. Touches only files owned by this series (no changes to
external/ or unrelated tests).
…sor.md anchors

- Add 'Backend' to expected user_api list in tests/python/test_api.py
- Reorder _tensor import in __init__.py to satisfy ruff isort
- Replace broken #fields/#ndarrays anchors in tensor.md with plain code spans

Made-with: Cursor
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.

1 participant