Solution: volatile was removed and now has no effect. Use with torch.no_grad():
instead.
Source code
self.priors = Variable(self.priorbox.forward(), volatile=True)
the reason
It volatilehas been removed in the torch version .
Before pytorch 0.4.0 input = Variable(input, volatile=True) set volatile to True, as long as an input is volatile, the output is also volatile, which can guarantee that there is no intermediate state; but canceled after pytorch 0.4.0 The volatile mechanism is replaced with functions such as torch.no_grad(), torch.set_grad_enable(grad_mode)
torch.no_grad() is a context manager.
When using pytorch , not all operations require the generation of calculation graphs (the construction of the calculation process to facilitate gradient back propagation and other operations). For the calculation operation of tensor, the default is to construct the calculation graph. In this case, you can use with torch.no_grad(): to force the subsequent content not to construct the calculation graph.
The torch.no_grad() will affect pytorch’s backpropagation mechanism. In the test, because it is determined that backpropagation will not be used, this mode can help save memory space. The same is true for torch.set_grad_enable(grad_mode)
change into
with torch.no_grad():
self.priors = Variable(self.priorbox.forward())
or
self.priors = Variable(self.priorbox.forward())
Read More:
- Pytorch error: `module ‘torch‘ has no attribute ‘__version___‘`
- [Solved] Error: The superclass, ‘Animal‘, has no unnamed constructor that takes no arguments.
- [Solved] GitHub Error: remote: Support for password authentication was removed on August 13, 2021.
- [Solved] keil5 Error: Error: L6915E: Library reports error: __use_no_semihosting was requested
- Support for password authentication was removed on August 13, 2021
- [Solved] FileUploadException: the request was rejected because no multipart boundary was found
- [Solved] Git push Error: remote: Support for password authentication was removed on August 13, 2021.
- Git push Submit to Remote Error: “remote: Support for password authentication was removed on August 13, 2021.“
- IText The document has no pages [How to Solve]
- An error was reported when Maven package was running the packaged jar package: there is no main list attribute in xxx.jar, which can be solved by configuring Maven plugin
- Hash_map is deprecated and will be REMOVED. Please use unordered_map.
- [Jeston Xavier NX Compile librealsense Error] AttributeError: module ‘pyrealsense2‘ has no attribute ‘pipeline‘
- Numpy.exp Function Error ‘Float’ object has no attribute ‘exp’
- [Solved] Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service ****** was f
- [Solved] MSP430F5529 Error initializing emulator:No USB FET was found
- Yolox_s.pth Convert to tensorRT Error: AttributeError: ‘tensorrt.tensorrt.Builder‘ object has no attribute ‘max_workspace_size‘
- Error: Unable to build IHost No DbContext named ‘PersistedGrantDbContext‘ was found.
- [Solved] OpenCV error: #error “This header with legacy C API declarations has been removed from OpenCV.
- [Solved] @webservice Error: org.apache.cxf.common.i18n.UncheckedException: No operation was found with
- [Solved] redis Error: AttributeError: ‘list‘ object has no attribute ‘decode‘