From bdc0e9b8dcc6d41cfd10459f66907109da301d66 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Mon, 22 Feb 2021 13:29:48 +0000 Subject: [PATCH 1/2] removed call to optimze_for_mobile --- android/test_app/make_assets.py | 6 +++--- torchvision/models/detection/generalized_rcnn.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/android/test_app/make_assets.py b/android/test_app/make_assets.py index 7860c759a57..ce5059b46ee 100644 --- a/android/test_app/make_assets.py +++ b/android/test_app/make_assets.py @@ -1,6 +1,5 @@ import torch import torchvision -from torch.utils.mobile_optimizer import optimize_for_mobile print(torch.__version__) @@ -13,5 +12,6 @@ model.eval() script_model = torch.jit.script(model) -opt_script_model = optimize_for_mobile(script_model) -opt_script_model.save("app/src/main/assets/frcnn_mnetv3.pt") +# TODO: put back call to optimize_for_mobile once +# https://github.com/pytorch/pytorch/issues/52463 is fixed +script_model.save("app/src/main/assets/frcnn_mnetv3.pt") diff --git a/torchvision/models/detection/generalized_rcnn.py b/torchvision/models/detection/generalized_rcnn.py index c321e79f298..0dee606f657 100644 --- a/torchvision/models/detection/generalized_rcnn.py +++ b/torchvision/models/detection/generalized_rcnn.py @@ -39,6 +39,7 @@ def eager_outputs(self, losses, detections): return losses return detections + def forward(self, images, targets=None): # type: (List[Tensor], Optional[List[Dict[str, Tensor]]]) -> Tuple[Dict[str, Tensor], List[Dict[str, Tensor]]] From a81937d052c8f08eb4ea2da2593b4844e247ff7f Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Mon, 22 Feb 2021 13:32:24 +0000 Subject: [PATCH 2/2] removed unrelated changes --- torchvision/models/detection/generalized_rcnn.py | 1 - 1 file changed, 1 deletion(-) diff --git a/torchvision/models/detection/generalized_rcnn.py b/torchvision/models/detection/generalized_rcnn.py index 0dee606f657..c321e79f298 100644 --- a/torchvision/models/detection/generalized_rcnn.py +++ b/torchvision/models/detection/generalized_rcnn.py @@ -39,7 +39,6 @@ def eager_outputs(self, losses, detections): return losses return detections - def forward(self, images, targets=None): # type: (List[Tensor], Optional[List[Dict[str, Tensor]]]) -> Tuple[Dict[str, Tensor], List[Dict[str, Tensor]]]