Is it possible to create a ScriptModule for torchvision Retinanet model?

Hi, I am using retinanet_resnet50_fpn_v2 as defined here:

I want to convert it to ONNX and use dynamic inputs and outputs, and I saw that using Scripting is recommended for this.

However when I try this like script_module = torch.jit.script(model), I get the following error:

  File "/lib/python3.9/site-packages/torch/onnx/", line 1529, in _export
    graph, params_dict, torch_out = _model_to_graph(
  File "/lib/python3.9/site-packages/torch/onnx/", line 1111, in _model_to_graph
    graph, params, torch_out, module = _create_jit_graph(model, args)
  File "/lib/python3.9/site-packages/torch/onnx/", line 967, in _create_jit_graph
    module, params = _C._jit_onnx_list_model_parameters(freezed_module)
Unknown type __torch__.torchvision.models.detection._utils.BoxCoder (of Python compilation unit at: 0x5bb5610) encountered in handling model params. This class type does not extend __getstate__ method.:

Should Scripting be possible for this model?