attention-ocr
attention-ocr copied to clipboard
Index out of range error during eval
for i in range(decoder_output.size(1)):
loss += criterion(decoder_output[:, i, :].squeeze(), target_tensor[:, i + 1])
line 55 in train_utils throws the following error -
IndexError: index 7 is out of bounds for dimension 1 with size 7
if i change the i+1 in the above mentioned line to i, the script runs fine but my evaluation accuracy doesn't change at all even though after 100 epochs training accuracy reaches 85%.
To make this hack work, i also have to change i+1 to i in line 64.
Similar lines are there in train_batch function too but that doesn't throw an error. Only eval does.
Could you tell me what these particular lines do and how I can fix this issue?
Thanks in advance.