Torch.jit.script is not working with fasterrcnn

Hello Everyone,

I have been trying to figure out an issue with torchscript in c++
I get the following error:

forward() Expected a value of type ‘List[Tensor]’ for argument ‘images’ but instead found type ‘Tensor’.
Position: 1
Declaration: forward(torch.torchvision.models.detection.faster_rcnn.FasterRCNN self, Tensor images, Dict(str, Tensor)? targets=None) → ((Dict(str, Tensor), Dict(str, Tensor)))

I tried annotating the images variable in the forward method with List[torch.Tensor] but the error persists

I even annotated the forward method in

the code is built off of this tutorial:

I am using torch.jit.script(model)

when I debug the scripted model, the forward method code starts with this

'def forward(self,\n    images: List[Tensor],\n    targets: Optional[List[Dict[str, Tensor]]]=None) -> Tuple[Dict[str, Tensor], List[Dict[str, Tensor]]]:\n

I would really appreciate the help