Problems encountered
/home/optimizer-master/third_party/onnx_common/tensor.h:117: size_from_dim: Assertion dim >= 0 && (size_t)dim < sizes_.size() failed.
Problem description
When import onnx, I encountered the above problems
Solution:
If there is an op operation that cannot be exported during onnx export, this error will be reported
How to Solve:
find the operation that cannot be exported and add a judgment. If you export onnx, the op will not be used. An example is as follows
def forward(self, x):
if torch.onnx.is_in_onnx_export():# if onnx
return x * self.act(x)/6
else: # normally
return x * self.act(x + 3)/6
Read More:
- RuntimeError: Exporting the operator uniform to ONNX opset version 12 is not supported.
- Cv2.dnn read model error [How to Solve]
- RuntimeError: ONNX export failed: Couldn‘t export operator aten::upsample_bilinear2d
- [Solved] pytorch CrossEntropyLoss Error: RuntimeError: 1D target tensor expected, multi-target not supported
- [Solved] volatile was removed and now has no effect. Use `with torch.no_grad():` instead.
- [Solved] RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR
- Libtorch Error: Expected object of type Variable but found type CUDALongType for argument #2 ‘index’
- [Solved] RuntimeError: each element in list of batch should be of equal size
- RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future rel
- RuntimeError: CUDNN_STATUS_EXECUTION_FAILED [How to Solve]
- Yolox_s.pth Convert to tensorRT Error: AttributeError: ‘tensorrt.tensorrt.Builder‘ object has no attribute ‘max_workspace_size‘
- MOTR compiling error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_R
- [Solved] torch Do Targer Detection Error: RuntimeError: CUDA error: device-side assert triggered
- [Solved] CUDA error:-UserWarning: CUDA initialization: CUDA unknown error
- [Solved] VUE Use Filters Error: [Vue warn]: Error in render: “TypeError: Cannot read property ‘toFixed’ of undefined”
- TensorFlow error: AttributeError: module ‘tensorflow_core._api.v2.train’ has no attribute ‘Optimizer‘
- [Solved] TensorFlow Error: ‘Tensor‘ object does not support item assignment
- Vitis-AI Generate a Quantitative Model: NotImplementedError
- [Solved] Pytorch loading model specified GPU card number error or failed to specify