Skip to content

Clarify tensor conversion example by padding sequences to equal length#1183

Open
Karthika-ps wants to merge 1 commit intohuggingface:mainfrom
Karthika-ps:patch-2
Open

Clarify tensor conversion example by padding sequences to equal length#1183
Karthika-ps wants to merge 1 commit intohuggingface:mainfrom
Karthika-ps:patch-2

Conversation

@Karthika-ps
Copy link

The original example showed sequences of different lengths, which cannot be directly converted to a tensor. This update adds padding to ensure the sequences are rectangular before tensor conversion.

The original example showed sequences of different lengths, which cannot be directly converted to a tensor. This update adds padding to ensure the sequences are rectangular before tensor conversion.
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@junepil
Copy link
Contributor

junepil commented Feb 15, 2026

I was also confused about the example in this chapter and doubt the purpose of the code. 👍

@Karthika-ps
Copy link
Author

I was also confused about the example in this chapter and doubt the purpose of the code. 👍

Thanks for the feedback! I had the same confusion initially. The main goal of the change was to clarify that sequences of different lengths cannot be directly converted to a tensor, and that padding is required first to make the inputs rectangular. I’m glad this confusion was shared.

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.

3 participants

Comments