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

Hi, I am using retinanet_resnet50_fpn_v2 as defined here: https://github.com/pytorch/vision/blob/main/torchvision/models/detection/retinanet.py

I want to convert it to ONNX and use dynamic inputs and outputs, and I saw that using Scripting is recommended for this.
https://pytorch.org/docs/stable/onnx.html#tracing-vs-scripting

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/utils.py", line 1529, in _export
    graph, params_dict, torch_out = _model_to_graph(
  File "/lib/python3.9/site-packages/torch/onnx/utils.py", line 1111, in _model_to_graph
    graph, params, torch_out, module = _create_jit_graph(model, args)
  File "/lib/python3.9/site-packages/torch/onnx/utils.py", line 967, in _create_jit_graph
    module, params = _C._jit_onnx_list_model_parameters(freezed_module)
RuntimeError: 
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?