Closed pengzhangzhi closed 2 years ago
when I tried to use code : adaptive = robust_loss_pytorch.adaptive.AdaptiveLossFunction( num_dims = 3, float_dtype=torch.cuda.FloatTensor, device=torch.device('cuda'))
still got an error:
ValueError Traceback (most recent call last)
<ipython-input-352-9429c9b297ff> in <module>()
2
3 adaptive = robust_loss_pytorch.adaptive.AdaptiveLossFunction(
----> 4 num_dims = 3, float_dtype=torch.cuda.FloatTensor, device=torch.device('cuda'))
~/anaconda3/envs/torch36/lib/python3.6/site-packages/robust_loss_pytorch/adaptive.py in __init__(self, num_dims, float_dtype, device, alpha_lo, alpha_hi, alpha_init, scale_lo, scale_init)
130 (isinstance(device, str) and 'cuda' in device) or\
131 (isinstance(device, torch.device) and device.type == 'cuda'):
--> 132 torch.cuda.set_device(self.device)
133
134 self.distribution = distribution.Distribution()
~/anaconda3/envs/torch36/lib/python3.6/site-packages/torch/cuda/__init__.py in set_device(device)
241 if this argument is negative.
242 """
--> 243 device = _get_device_index(device)
244 if device >= 0:
245 torch._C._cuda_setDevice(device)
~/anaconda3/envs/torch36/lib/python3.6/site-packages/torch/cuda/_utils.py in _get_device_index(device, optional)
32 else:
33 raise ValueError('Expected a cuda device with a specified index '
---> 34 'or an integer, but got: '.format(device))
35 return device_idx
ValueError: Expected a cuda device with a specified index or an integer, but got:
```
I am totally freaking out by the error!!(I an stuck as there for 2 days!)
Hope to konw what is the correct usage!
Thank you for such an amazing work!
Hi,there! When I implemented the following code:
I got the error:
I am confused why there is a type error.
Would you please provide me some solutions?
Thanks a million!