Python 3.6.13 |Anaconda, Inc.| (default, Jun 4 2021, 14:25:59)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import torch
torch.cuda.is_available()
True
torch.cuda.device_count()
1
torch.cuda.get_device_name(0)
'NVIDIA GeForce RTX 3060'
torch.tensor([1.0, 2.0]).cuda()
tensor([1., 2.], device='cuda:0')
上述是安装的cuda11.0+pytorch1.7.1的,采用GPU报上述错误,怎么回事呢
Traceback (most recent call last):
File "style_transfer.py", line 113, in
img_rec, instyle = encoder(F.adaptive_avg_pool2d(I, 256), randomize_noise=False, return_latents=True, z_plus_latent=True, return_z_plus_latent=True, resize=False)
File "/home/hjq/anaconda3/envs/dual/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, kwargs)
File "/media/hjq/EC3C5BDA3C5B9E80/win10/hjq_code/style_transfer/DualStyleGAN/model/encoder/psp.py", line 97, in forward
images, result_latent = self.decoder([codes],
File "/home/hjq/anaconda3/envs/dual/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, *kwargs)
File "/media/hjq/EC3C5BDA3C5B9E80/win10/hjq_code/styletransfer/DualStyleGAN/model/stylegan/model.py", line 521, in forward
style.append(self.style(s[:,i]).unsqueeze(1))
File "/home/hjq/anaconda3/envs/dual/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(input, kwargs)
File "/home/hjq/anaconda3/envs/dual/lib/python3.8/site-packages/torch/nn/modules/container.py", line 117, in forward
input = module(input)
File "/home/hjq/anaconda3/envs/dual/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, *kwargs)
File "/media/hjq/EC3C5BDA3C5B9E80/win10/hjq_code/style_transfer/DualStyleGAN/model/stylegan/model.py", line 152, in forward
out = F.linear(input, self.weight self.scale)
RuntimeError: CUDA error: no kernel image is available for execution on the device
Segmentation fault (core dumped)
Python 3.6.13 |Anaconda, Inc.| (default, Jun 4 2021, 14:25:59) [GCC 7.5.0] on linux Type "help", "copyright", "credits" or "license" for more information.