Skip to content

feat: add ComplexType to the DataType hierarchy#5

Open
sebffischer wants to merge 1 commit into
mainfrom
dev/20260428-complex-type
Open

feat: add ComplexType to the DataType hierarchy#5
sebffischer wants to merge 1 commit into
mainfrom
dev/20260428-complex-type

Conversation

@sebffischer
Copy link
Copy Markdown
Contributor

Summary

  • Adds ComplexType(value) for complex<f32> / complex<f64> (a.k.a. c64 / c128), mirroring FloatType.
  • Extends as_dtype() and dtype_map to recognize "c64" and "c128" strings.
  • Updates the DataType virtual-class docs and the assert_dtype error message to mention ComplexType.

Prerequisite for hlo_fft() in stablehlo (which uses complex element types per the StableHLO spec).

Test plan

  • testthat::test_local("tengen") — 40 passed, 0 failures.
  • ComplexType(32) prints as <c64>, ComplexType(64) as <c128>.
  • as_dtype("c64") and as_dtype("c128") round-trip.

🤖 Generated with Claude Code

Adds ComplexType(value) for representing complex<f32> (c64) and
complex<f64> (c128) tensor element types, mirroring the structure of
FloatType. Extends as_dtype() and dtype_map to recognize "c64" and
"c128" strings.

Needed by stablehlo for the upcoming hlo_fft() op.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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