pytorch-implementations
pytorch-implementations copied to clipboard
global variables are being used instead of instance variables in `DecoderWithAttention` in "Show, Attend and Tell.ipynb"
trafficstars
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.