Onnx export runtime error : outerNode->outputs().size() == node->inputs().size() INTERNAL ASSERT FAILED

I converted the already created onnx model to phytorch, retrained it, but when I tried to export it back to onnx, I keep getting the following error. The same error appears when I export to onnx immediately without training after converting to pytorch so I don’t think there was a problem with training.

The same error appears every time I write ‘torch.onnx.export’. And I double checked the type and shape of the model input when writing ‘torch.onnx.export’.

Does anyone know why?

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/var/folders/49/9g9lxm9d3f3br8zlg2l2fmz80000gn/T/ipykernel_1349/2634282627.py in <module>
----> 1 torch.onnx.export(model, x, "output.onnx")

/opt/anaconda3/lib/python3.9/site-packages/torch/onnx/utils.py in export(model, args, f, export_params, verbose, training, input_names, output_names, operator_export_type, opset_version, do_constant_folding, dynamic_axes, keep_initializers_as_inputs, custom_opsets, export_modules_as_functions)
    502     """
    503 
--> 504     _export(
    505         model,
    506         args,

/opt/anaconda3/lib/python3.9/site-packages/torch/onnx/utils.py in _export(model, args, f, export_params, verbose, training, input_names, output_names, operator_export_type, export_type, opset_version, do_constant_folding, dynamic_axes, keep_initializers_as_inputs, fixed_batch_size, custom_opsets, add_node_names, onnx_shape_inference, export_modules_as_functions)
   1527             _validate_dynamic_axes(dynamic_axes, model, input_names, output_names)
   1528 
-> 1529             graph, params_dict, torch_out = _model_to_graph(
   1530                 model,
   1531                 args,

/opt/anaconda3/lib/python3.9/site-packages/torch/onnx/utils.py in _model_to_graph(model, args, verbose, input_names, output_names, operator_export_type, do_constant_folding, _disable_torch_constant_prop, fixed_batch_size, training, dynamic_axes)
   1113 
   1114     try:
-> 1115         graph = _optimize_graph(
   1116             graph,
   1117             operator_export_type,

/opt/anaconda3/lib/python3.9/site-packages/torch/onnx/utils.py in _optimize_graph(graph, operator_export_type, _disable_torch_constant_prop, fixed_batch_size, params_dict, dynamic_axes, input_names, module)
    580     _C._jit_pass_lint(graph)
    581     _C._jit_pass_onnx_autograd_function_process(graph)
--> 582     **_C._jit_pass_lower_all_tuples(graph)**
    583 
    584     # we now record some ops like ones/zeros

**RuntimeError: outerNode->outputs().size() == node->inputs().size() INTERNAL ASSERT FAILED at "/Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/jit/passes/dead_code_elimination.cpp":140, please report a bug to PyTorch.**