Skip to content

Small inconsistency in Chapter 2, Part 3 example #1269

Description

@Javid-03

I noticed a small inconsistency at the end of Chapter 2, Part 3.

The example shows:

encoded_sequences = [
[...], # length 16
[...], # length 8
]

model_inputs = torch.tensor(encoded_sequences)

Since the two sequences have different lengths, torch.tensor(encoded_sequences) will raise an error because tensors require all rows to have the same length.

A simple fix would be to make encoded_sequences rectangular by padding the shorter sequence before converting it to a tensor. This would make the example consistent with the explanation.

Thanks for the great course!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions