Serialization RetinaNet

What is wrong with this code?

model = torchvision.models.detection.retinanet.retinanet_resnet50_fpn(pretrained=True)
model.eval()
input_tensor = torch.rand(1,3, 224, 224)
script_model = torch.jit.trace(model, input_tensor)
script_model.save("test.pt")

It raises an error: “Only tensors, lists, tuples of tensors, or dictionary of tensors can be output from traced functions”