Handle scalar tensor shape formatting#20411
Open
fallintoplace wants to merge 1 commit into
Open
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20411
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below:
|
|
|
Author
|
@pytorchbot label "release notes: none" |
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.
Summary
Fixes scalar tensor shape formatting in
tensor_shape_to_c_string_impl().The helper used to write an opening parenthesis, skip the dimension loop for scalar shapes, then patch
p - 2andp - 1. For an empty shape,p - 2points before the output buffer. Scalar shapes now return"()"before entering the trailing-comma rewrite path.Also adds tests for:
{}{3}ERRformattingkTensorDimensionLimitTest Plan
git diff --check -- runtime/core/exec_aten/util/tensor_shape_to_c_string.cpp runtime/core/exec_aten/util/test/tensor_shape_to_c_string_test.cppc++smoke test againsttensor_shape_to_c_string.cppcovering scalar, rank-1, negative, and near-limit shapesI also attempted the CMake/gtest path, but a fresh root configure entered the broader project codegen flow and did not complete promptly in this local checkout.