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

invalid index of a 0-dim tensor. Use tensor.item() in Python or tensor.item<T>() in C++ to convert a 0-dim tensor to a number #7

Open
avatar-lavventura opened this issue Dec 7, 2021 · 0 comments

Comments

@avatar-lavventura
Copy link

avatar-lavventura commented Dec 7, 2021

Following pages are installed using pip install -e .:

torch==1.10.0
torchvision==0.11.1

I am having following error:

$ cifar10 train -c last --augmentation --tracking -b 128 --optimizer sgd --arch preact164 -e 5 -l 0.0
Traceback (most recent call last):
  File "/home/alper/venv/bin/cifar10", line 33, in <module>
    sys.exit(load_entry_point('benchmark', 'console_scripts', 'cifar10')())
  File "/home/alper/venv/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/alper/venv/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/alper/venv/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/alper/venv/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/alper/venv/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/alper/tools/dawn-bench-models/pytorch/CIFAR10/benchmark/cifar10/train.py", line 345, in train
    run(epoch, model, train_loader, criterion, optimizer,
  File "/home/alper/tools/dawn-bench-models/pytorch/CIFAR10/benchmark/cifar10/train.py", line 113, in run
    losses.update(loss.data[0], batch_size)
IndexError: invalid index of a 0-dim tensor. Use `tensor.item()` in Python or `tensor.item<T>()` in C++ to convert a 0-dim tensor to a number

How can I resolve this error it?

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

1 participant