From c140317d299a0fed9cc69d80123f58e38b0c3846 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Haian=20Huang=28=E6=B7=B1=E5=BA=A6=E7=9C=B8=29?=
 <1286304229@qq.com>
Date: Tue, 9 Mar 2021 17:43:40 +0800
Subject: [PATCH] Fix FASF onnx export support (#4735)

---
 mmdet/core/bbox/coder/tblr_bbox_coder.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mmdet/core/bbox/coder/tblr_bbox_coder.py b/mmdet/core/bbox/coder/tblr_bbox_coder.py
index eaa4ada0..ccf796ad 100644
--- a/mmdet/core/bbox/coder/tblr_bbox_coder.py
+++ b/mmdet/core/bbox/coder/tblr_bbox_coder.py
@@ -170,7 +170,9 @@ def tblr2bboxes(priors,
         w, h = torch.split(wh, 1, dim=-1)
         loc_decode[..., :2] *= h  # tb
         loc_decode[..., 2:] *= w  # lr
-    top, bottom, left, right = loc_decode.split(1, dim=-1)
+
+    # Cannot be exported using onnx when loc_decode.split(1, dim=-1)
+    top, bottom, left, right = loc_decode.split((1, 1, 1, 1), dim=-1)
     xmin = prior_centers[..., 0].unsqueeze(-1) - left
     xmax = prior_centers[..., 0].unsqueeze(-1) + right
     ymin = prior_centers[..., 1].unsqueeze(-1) - top
-- 
GitLab