Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: invalid index of a 0-dim tensor #4

Open
cuongcx opened this issue Mar 19, 2019 · 1 comment
Open

IndexError: invalid index of a 0-dim tensor #4

cuongcx opened this issue Mar 19, 2019 · 1 comment

Comments

@cuongcx
Copy link

cuongcx commented Mar 19, 2019

Run command: python main.py onto -lstm_type single -goal onto -enhanced_mention

Error:

.../model_utils.py:167: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
weighted_keys = self.key_softmax(k).view(input_embed.size()[0], -1, 1)
Traceback (most recent call last):
File "main.py", line 276, in
_train(config)
File "main.py", line 133, in _train
total_loss += loss.data.cpu()[0]
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

@helloleejq
Copy link

Run command: python main.py onto -lstm_type single -goal onto -enhanced_mention

Error:

.../model_utils.py:167: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
weighted_keys = self.key_softmax(k).view(input_embed.size()[0], -1, 1)
Traceback (most recent call last):
File "main.py", line 276, in
_train(config)
File "main.py", line 133, in _train
total_loss += loss.data.cpu()[0]
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

total_loss += loss.data.cpu().item()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants