Skip to content

inconsistent / ambiguous comment notation in LSTM example code (N , n) #2

@shott92

Description

@shott92

Hi,

In the LSTM code example, you use both lower an upper case n, I struggle to distinguish the difference between the two or if they are both referring to batch sizes?
I'm utilise this code to learn how to implement my own LSTM model. but I am getting an error
"RuntimeError: Expected hidden size (1, 4, 128), got [1, 28, 128]"
In this instance my batch size is 4, and number of layers is one, hense the 2nd array/tensor size is [num layers, image size, number of hidden layers].

The expected hidden size appears to be [num layers, batch size, num hidden layers]
I suspect I'll debug this soon, but I think that the following lines could be clearer in your code if N was defined in the comment.

# origin shape: [N, 1, 28, 28]

you and your amazing videos have been a huge help as I learn about NNs and Pytorch, thanks!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions