PyTorchZeroToAll
PyTorchZeroToAll copied to clipboard
Fixed dimension bugs in 12_2_hello_rnn.py
Error messages were
- "RuntimeError: dimension specified as 0 but tensor has no dimensions". (line: 24) --> I changed the dimension using '.view'(-1, 1)' to make the label dimension to be 1 instead of "no dimensions"
- "IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number" (line: 80) --> Since the output of the Cross Entropy Loss here has no dimension, deleted the index term '[0]'.
It was tested with Pytorch 1.1.
Could you check if the new merge fixed this problem? Thanks!