Skip to content

global variables are being used instead of instance variables in DecoderWithAttention in "Show, Attend and Tell.ipynb" #1

@naveenmarthala

Description

@naveenmarthala

I could identify some places, where the global variables are being used inside DecoderWithAttention, like this line in forward method:

        # flatten image
        encoder_out = encoder_out.view(batch_size, -1, encoder_dim)

I presume encoder_dim should have been self.encoder_dim!
and here

        # create tensors to hold word prediction scores and alphas
        predictions = torch.zeros(batch_size, max(decode_lens), vocab_size).to(device)

vocab_size should instead be self.vocab_size.

Please correct me If I got this wrong.

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