[pyTorch] Replace the make_empty implementation to use C++ implementation#2666
Draft
ptrendx wants to merge 4 commits intoNVIDIA:mainfrom
Draft
[pyTorch] Replace the make_empty implementation to use C++ implementation#2666ptrendx wants to merge 4 commits intoNVIDIA:mainfrom
ptrendx wants to merge 4 commits intoNVIDIA:mainfrom
Conversation
known quantizers Signed-off-by: Przemek Tredak <ptredak@nvidia.com>
Member
Author
|
/te-ci L1 pytorch |
for more information, see https://pre-commit.ci
Signed-off-by: Przemek Tredak <ptredak@nvidia.com>
Member
Author
|
/te-ci L1 pytorch |
negvet
reviewed
Feb 12, 2026
| """Construct quantized tensor with uninitialized data""" | ||
| raise NotImplementedError( | ||
| f"{self.__class__.__name__} class does not implement make_empty function, " | ||
| "required for construction of unintialized quantized tensor" |
Collaborator
There was a problem hiding this comment.
This clear NotImplementedError is beneficial for custom quantizers that do not override make_empty().
Now, if custom quantizer does not have make_empty(), then it will fail at the C++ convert_quantizer, because there is no registered C++ converter. C++ failure with NVTE_ERROR("Unexpected type for quantizer") is not as clear as NotImplementedError.
What about making C++ error more clear or even better add a check at base Quantizer.make_empty:
def make_empty(...):
if getattr(self, "custom", False):
raise NotImplementedError(
f"{self.__class__.__name__} does not implement make_empty"
)
# ... existing C++ path ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR unifies the implementation of the QuantizedTensor creation by using the C++ implementation of the create_tensor.
Type of change
Changes
Please list the changes introduced in this PR:
Checklist: