I try exporting to onnx model from pytorch.
Here is my code:
import torch

from darknet import Darknet

det_model = Darknet("../yolo/cfg/yolov3-spp.cfg")
det_model.load_weights('../models/yolo/yolov3-spp.weights')
dummy_input=torch.Tensor(1,3,608,608)
torch.onnx.export(det_model,(dummy_input,True),'darknet.onnx')

Here is the error:
Traceback (most recent call last):
  File "/home/test1050/Desktop/tf-pt/playground/play.py", line 14, in <module>
    torch.onnx.export(det_model,(dummy_input,),'darknet.onnx')
  File "/home/test1050/miniconda3/lib/python3.6/site-packages/torch/onnx/__init__.py", line 25, in export
    return utils.export(*args, **kwargs)
  File "/home/test1050/miniconda3/lib/python3.6/site-packages/torch/onnx/utils.py", line 84, in export
    _export(model, args, f, export_params, verbose, training, input_names, output_names)
  File "/home/test1050/miniconda3/lib/python3.6/site-packages/torch/onnx/utils.py", line 134, in _export
    trace, torch_out = torch.jit.get_trace_graph(model, args)
  File "/home/test1050/miniconda3/lib/python3.6/site-packages/torch/jit/__init__.py", line 255, in get_trace_graph
    return LegacyTracedModule(f, nderivs=nderivs)(*args, **kwargs)
  File "/home/test1050/miniconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/test1050/miniconda3/lib/python3.6/site-packages/torch/jit/__init__.py", line 291, in forward
    torch._C._tracer_exit(out_vars)
RuntimeError: /pytorch/torch/csrc/jit/tracer.h:120: getTracingState: Assertion `state` failed.Preformatted text

I am new for ONNX.Anyone give me some help,thx.