Skip to content

RuntimeError: value cannot be converted to type uint8_t without overflow: 10000 #3

@BearockXY

Description

@BearockXY

I use python 2.7 and cuda 9.1 to run the code. I met some warming and error.

capsulenet.py:165: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
training_loss += loss.data[0] * x.size(0) # record the batch loss
capsulenet.py:121: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead.
x, y = Variable(x.cuda(), volatile=True), Variable(y.cuda())
capsulenet.py:123: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
test_loss += caps_loss(y, y_pred, x, x_recon, args.lam_recon).data[0] * x.size(0) # sum up batch loss
Traceback (most recent call last):
File "capsulenet.py", line 255, in
train(model, train_loader, test_loader, args)
File "capsulenet.py", line 169, in train
val_loss, val_acc = test(model, test_loader, args)
File "capsulenet.py", line 129, in test
return test_loss, correct / len(test_loader.dataset)
RuntimeError: value cannot be converted to type uint8_t without overflow: 10000

Do you have any idea how to solve it?

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