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

Expected object of scalar type Float but got scalar type Long for sequence element 1 in sequence argument at position #1 'tensors #4

Open
rogelioamancisidor opened this issue Oct 5, 2021 · 0 comments

Comments

@rogelioamancisidor
Copy link

Running python -u -m vibcreg.examples.learn_representations throws the following error:

Traceback (most recent call last):
 File "/opt/conda/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
 File "/opt/conda/lib/python3.6/runpy.py", line 85, in _run_code
 exec(code, run_globals)
 File "/mnt/azure/vibcreg/vibcreg/examples/learn_representations.py", line 53, in <module>
  rl_util, optimizer)
 File "/mnt/azure/vibcreg/vibcreg/wrapper/run_wrapper.py", line 25, in run_ssl_for_rl
  rl_util.get_batch_of_representations(test_data_loader, dataset_name)  # stored internally
 File "/opt/conda/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 49, in decorate_no_grad
   return func(*args, **kwargs)
 File "/mnt/azure/vibcreg/vibcreg/frameworks/framework_util_skeleton.py", line 284, in get_batch_of_representations
    labels = torch.cat((labels, label.cpu()), dim=0)
RuntimeError: Expected object of scalar type Float but got scalar type Long for sequence element 1 in sequence argument at position #1 'tensors'

I fixed it by replacing labels = torch.cat((labels, label.cpu()), dim=0) for labels = torch.cat((labels, label.float().cpu()) dim=0) in line 284 in file framework_util_skeleton.py

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