Skip to content

Error in 13_3_char_rnn.py #46

Open
@KawhiZhao

Description

@KawhiZhao

Training for 100 epochs...
Traceback (most recent call last):
File "F:/pytorch/PyTorchZeroToAll-master/13_3_char_rnn.py", line 142, in
loss = train(lines[0]) # Batch size is 1
File "F:/pytorch/PyTorchZeroToAll-master/13_3_char_rnn.py", line 117, in train
loss += criterion(output, target[c])
File "C:\Users\hh\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "C:\Users\hh\Anaconda3\lib\site-packages\torch\nn\modules\loss.py", line 862, in forward
ignore_index=self.ignore_index, reduction=self.reduction)
File "C:\Users\hh\Anaconda3\lib\site-packages\torch\nn\functional.py", line 1550, in cross_entropy
return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
File "C:\Users\hh\Anaconda3\lib\site-packages\torch\nn\functional.py", line 1403, in nll_loss
if input.size(0) != target.size(0):
RuntimeError: dimension specified as 0 but tensor has no dimensions

Process finished with exit code 1

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