Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

second SpMiddleFHDLite network how to convert to ONNX #477

Open
whzz101 opened this issue Feb 17, 2022 · 0 comments
Open

second SpMiddleFHDLite network how to convert to ONNX #477

whzz101 opened this issue Feb 17, 2022 · 0 comments

Comments

@whzz101
Copy link

whzz101 commented Feb 17, 2022

Because car.lite.config use SpMiddleFHDLite network, how can I convert SpMiddleFHDLite to ONNX, I try to convert but failed,

elif ndim == 3:
/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/spconv/ops.py:116: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
int(inverse), int(subm))
/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/spconv/modules.py:136: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if input.indices.shape[0] != 0:
/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/spconv/init.py:45: TracerWarning: Converting a tensor to a Python index might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
output_shape = list(indices.shape[:-1]) + shape[indices.shape[-1]:]
/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/spconv/init.py:47: TracerWarning: Converting a tensor to a Python index might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
slices = [flatted_indices[:, i] for i in range(ndim)]
Traceback (most recent call last):
File "second/zz_infer_second.py", line 141, in
demo()
File "second/zz_infer_second.py", line 123, in demo
pred = net(example)[0]
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/data/zhou.zhou/project/16_PointPillars/second.pytorch-1.5.1_20220216/second/pytorch/models/voxelnet.py", line 309, in forward
torch.onnx.export(self.middle_feature_extractor, (input1, input2), 'SpMiddleFHDLite.onnx', verbose=True, input_names=['voxel_features', "coors"], opset_version=12)
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/onnx/init.py", line 230, in export
custom_opsets, enable_onnx_checker, use_external_data_format)
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/onnx/utils.py", line 91, in export
use_external_data_format=use_external_data_format)
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/onnx/utils.py", line 639, in _export
dynamic_axes=dynamic_axes)
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/onnx/utils.py", line 411, in _model_to_graph
use_new_jit_passes)
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/onnx/utils.py", line 379, in _create_jit_graph
graph, torch_out = _trace_and_get_graph_from_model(model, args)
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/onnx/utils.py", line 342, in _trace_and_get_graph_from_model
torch.jit._get_trace_graph(model, args, strict=False, _force_outplace=False, _return_inputs_states=True)
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/jit/_trace.py", line 1148, in _get_trace_graph
outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/jit/_trace.py", line 130, in forward
self._force_outplace,
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/jit/_trace.py", line 116, in wrapper
outs.append(self.inner(*trace_inputs))
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/nn/modules/module.py", line 725, in _call_impl
result = self._slow_forward(*input, **kwargs)
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/torch/nn/modules/module.py", line 709, in _slow_forward
result = self.forward(*input, **kwargs)
File "/data/zhou.zhou/project/16_PointPillars/second.pytorch-1.5.1_20220216/second/pytorch/models/middle.py", line 805, in forward
ret = ret.dense() # [1, 64, 2, 250, 250]
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/spconv/init.py", line 81, in dense
res = scatter_nd(self.indices.long(), self.features, output_shape)
File "/home/cxhpc/zhouzhou/project_envs/P16_second_169/lib/python3.6/site-packages/spconv/init.py", line 49, in scatter_nd
ret[slices] = updates.view(*output_shape)
IndexError: index 2 is out of bounds for dimension 0 with size 1
*** Error in `python3': munmap_chunk(): invalid pointer: 0x000000007c2b5b00 ***

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant