Method 1
torch.backends.cudnn.enabled = True
torch.backends.cudnn.benchmark = True
Principle:
Cundnn follows the following criteria:
- if the dimension or type of network input data changes little, set torch.backends.cudnn.benchmark = true It can increase the operation efficiency; If the input data of the network changes every iteration, cndnn will find the optimal configuration every time, which will improve the operation efficiency ol>
Method 2
Tensor calculation should be written as follows:
train_loss += loss.item()
Read More:
- ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 256,
- [leetcode] 926. Flip string to monotone increasing problem solving report (Python)
- Runtimeerror using Python training model: CUDA out of memory error resolution
- Build your own resnet18 network and load torch vision’s own weight
- Remove video with video byte 0, uncaught (in promise) domexception: failed to load because no supported source was f
- How to use torch.sum()
- Solve the problem of “wireless network activation failure” in Ubuntu 18, and repeatedly pop up the password input interface
- Solve the problem of SQL Server limit 2G memory limit installation
- RuntimeError: NCCL error in: /pytorch/torch/lib/c10d/ProcessGroupNCCL.cpp:784 torch
- Video download problem of blob type URL
- RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the
- Memory leak in Windows 8.1 with Killer E2200 and Windows Network Data Usage Monitoring
- Network card problem: Unable to initialize Windows Sockets interface
- The Ubuntu status bar shows the network speed, memory and CPU utilization ratio
- Firefox: How to Solve “Network Protocol Error” (Two Methods)
- Debian using networking to restart the network can not start the solution of network card
- Video JS can’t play the prompt( CODE:4 MEDIA_ ERR_ SRC_ NOT_ SUPPORTED) No compatible source was found for this video.
- Solution summary of VMware network card without IP and failure to start network card (continuous update)
- RuntimeError: cudnn RNN backward can only be called in training mode
- To solve the problem of failed to load: data in HTML5 game running rmmv locally/ actors.json problem