Hi there,
I am trying to use torchscript to trace the ssdlite320_mobilenet_v3_large provided in torchvision. However, there was unexpected errors when I follow the docs.
import torch
import torch as th
import torch.nn as nn
from torchvision import models
import torch.onnx 

model = models.detection.ssdlite320_mobilenet_v3_large(pretrained=True)
model.eval()

x = [torch.rand(3, 320, 320), torch.rand(3, 500, 400)]

predictions = model(x) # successfully run without error
model_trace = torch.jit.trace(model, x) # fail to run

The error log
/home/ligeng/.local/lib/python3.8/site-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  ../aten/src/ATen/native/TensorShape.cpp:2157.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
Traceback (most recent call last):
  File "ssd_torchscript.py", line 15, in <module>
    model_trace = torch.jit.trace(model, x)
  File "/home/ligeng/.local/lib/python3.8/site-packages/torch/jit/_trace.py", line 741, in trace
    return trace_module(
  File "/home/ligeng/.local/lib/python3.8/site-packages/torch/jit/_trace.py", line 958, in trace_module
    module._c._create_method_from_trace(
  File "/home/ligeng/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/ligeng/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1090, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "/home/ligeng/.local/lib/python3.8/site-packages/torchvision/models/detection/ssd.py", line 310, in forward
    images, targets = self.transform(images, targets)
  File "/home/ligeng/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/ligeng/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1090, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "/home/ligeng/.local/lib/python3.8/site-packages/torchvision/models/detection/transform.py", line 100, in forward
    for k, v in t.items():
AttributeError: 'Tensor' object has no attribute 'items'