Skip to content

TE_DType in python#3039

Draft
vthumbe1503 wants to merge 2 commits into
NVIDIA:mainfrom
vthumbe1503:te_dtype
Draft

TE_DType in python#3039
vthumbe1503 wants to merge 2 commits into
NVIDIA:mainfrom
vthumbe1503:te_dtype

Conversation

@vthumbe1503
Copy link
Copy Markdown
Collaborator

Description

Please include a brief summary of the changes, relevant motivation and context.

Fixes # (issue)

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • Change A
  • Change B

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

vthumbe1503 and others added 2 commits May 22, 2026 21:50
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
@vthumbe1503 vthumbe1503 changed the title initial prototype TE_DType in python May 22, 2026
// when this runs, so the GIL is held and Python imports are legal.
static pybind11::object te_dtype_cls =
pybind11::module_::import("transformer_engine.pytorch.constants").attr("TE_DType");
return te_dtype_cls(static_cast<int>(dtype));
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.

Find a way to bind C++ and python Dtype through pybind cast mechanism

# pybind11 enum used as Quantizer.dtype
tex.DType,
# Python IntEnum used as Quantizer.dtype
TE_DType,
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.

save/load backward compatibilty should be there

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