Repository: pytorch
Issue: Scripting torchvision.models.detection.maskrcnn_resnet50_fpn
Labels: triaged,module: vision

## 🐛 Bug
**My Code:**
```
import torch
import torchvision

print('going in...')
# scripted_module = torch.jit.script(torch_model)
# scripted_module = torch.jit.script(GeneralizedRCNN(cfg.clone()))
torch.jit.script(torchvision.models.detection.maskrcnn_resnet50_fpn(pretrained=True))
```
<!-- A clear and concise description of what the bug is. -->
If I try to send `torchvision.models.detection.maskrcnn_resnet50_fpn` this model to `torch.jit.script` several errors are thrown.
## Errors Encountered
```
RuntimeError: 
Arguments for call are not valid.
The following operator variants are available:
  
  aten::append(Tensor[](a!) self, Tensor(c -> *) el) -> (Tensor[](a!)):
  Expected a value of type 'List[Tensor]' for argument 'self' but instead found type 'List[int]'.
  
  aten::append(int[](a!) self, int el) -> (int[](a!)):
  Expected a value of type 'int' for argument 'el' but instead found type 'List[int]'.
  
  aten::append(float[](a!) self, float el) -> (float[](a!)):
  Expected a value of type 'List[float]' for argument 'self' but instead found type 'List[int]'.
  
  aten::append(bool[](a!) self, bool el) -> (bool[](a!)):
  Expected a value of type 'List[bool]' for argument 'self' but instead found type 'List[int]'.
  
  aten::append(t[](a!) self, t(c -> *) el) -> (t[](a!)):
  Could not match type List[int] to t in argument 'el': Type variable 't' previously matched to type int is matched to type List[int].
  
  aten::append(str[](a!) self, str? el) -> (str[](a!)):
  Expected a value of type 'List[str]' for argument 'self' but instead found type 'List[int]'.

The original call is:
at /home/miller/anaconda3/envs/export/lib/python3.7/site-packages/torchvision/models/detection/generalized_rcnn.py:50:12
                like `scores`, `labels` and `mask` (for Mask R-CNN models).

        """
        if self.training and targets is None:
            raise ValueError("In training mode, targets should be passed")
        # original_image_sizes = [img.shape[-2:] for img in images]
        original_image_sizes = torch.jit.annotate(List[int],[])
        # original_image_sizes = []
        for img in images:
            original_image_sizes.append(img.shape[-2:])
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
        images, targets = self.transform(images, targets)
        features = self.backbone(images.tensors)
        if isinstance(features, torch.Tensor):
            features = OrderedDict([(0, features)])
        proposals, proposal_losses = self.rpn(images, features, targets)
        detections, detector_losses = self.roi_heads(features, proposals, images.image_sizes, targets)
        detections = self.transform.postprocess(detections, images.image_sizes, original_image_sizes)

        losses = {}
```
and if I change this `original_image_sizes.append(img.shape[-2:])` to this `original_image_sizes.append(torch.tensor(img.shape[-2:]))`. I encounter another error.
```
RuntimeError: 
iterator expression is expected to be a list, iterable, or range, found value of type 'Tensor':
at /home/miller/anaconda3/envs/export/lib/python3.7/site-packages/torchvision/models/detection/transform.py:33:18
    def forward(self, images, targets=None):
        images = [img for img in images]
                  ~~~~~~~~~~~~~~~~~~~~~ <--- HERE
```
## To Reproduce
Just use the above code to reproduce


<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior
A scripted version of `torchvision.models.detection.maskrcnn_resnet50_fpn`
<!-- A clear and concise description of what you expected to happen. -->

## Environment

- PyTorch version: 1.3.0a0+a7de545
- Is debug build: No
- CUDA used to build PyTorch: 10.0.130

- OS: Ubuntu 18.04.3 LTS
- GCC version: (Ubuntu 6.5.0-2ubuntu1~18.04) 6.5.0 20181026
- CMake version: version 3.15.4
 
- Python version: 3.7
- Is CUDA available: No
- CUDA runtime version: 10.0.130
- GPU models and configuration: Could not collect
- Nvidia driver version: Could not collect
- cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.3
 
- Versions of relevant libraries:
[pip] numpy==1.17.2
[pip] torch==1.3.0a0+a7de545
[pip] torchvision==0.4.0a0+6b959ee
[conda] blas                      1.0                         mkl  
[conda] mkl                       2019.4                      243  
[conda] mkl-service               2.3.0            py37he904b0f_0  
[conda] mkl_fft                   1.0.14           py37ha843d7b_0  
[conda] mkl_random                1.1.0            py37hd6b4f25_0  
[conda] pytorch                   1.2.0           py3.7_cuda10.0.130_cudnn7.6.2_0    pytorch
[conda] torch                     1.3.0a0+a7de545          pypi_0    pypi
[conda] torchvision               0.4.0                py37_cu100    pytorch
## Additional context

<!-- Add any other context about the problem here. -->