Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
253 views
in Technique[技术] by (71.8m points)

python - 0 <= device && device <device_num INTERNAL ASSERT FAILED at

  • The computer was able to run the code on the GPU.

  • I did a computer restart.

  • The computer cannot run the code and is recording the following error.


RuntimeError Traceback (most recent call last)
<ipython-input-8-186b7088820a> in <module>
      6 torch.cuda.empty_cache ()
      7
----> 8 print (torch.cuda.memory_allocated (0))

~ / anaconda3 / lib / python3.7 / site-packages / torch / cuda / memory.py in memory_allocated (device)
    276 details about GPU memory management.
    277 "" "
-> 278 return memory_stats (device = device) ["allocated_bytes.all.current"]
    279
    280

~ / anaconda3 / lib / python3.7 / site-packages / torch / cuda / memory.py in memory_stats (device)
    157 result.append ((prefix, obj))
    158
-> 159 stats = memory_stats_as_nested_dict (device = device)
    160 _recurse_add_to_result ("", stats)
    161 result.sort ()

~ / anaconda3 / lib / python3.7 / site-packages / torch / cuda / memory.py in memory_stats_as_nested_dict (device)
    167 "Returns the result of: func:` ~ torch.cuda.memory_stats` as a nested dictionary. "" "
    168 device = _get_device_index (device, optional = True)
-> 169 return torch._C._cuda_memoryStats (device)
    170
    171

RuntimeError: 0 <= device && device <device_num INTERNAL ASSERT FAILED at /pytorch/c10/cuda/CUDACachingAllocator.cpp:879, please report a bug to PyTorch. Invalid device argument. 
question from:https://stackoverflow.com/questions/65617192/0-device-device-device-num-internal-assert-failed-at

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...