From 572719c6d27256262a9483ccfd50e2d8e117c482 Mon Sep 17 00:00:00 2001 From: Aurelius84 Date: Tue, 19 Jul 2022 10:45:45 +0800 Subject: [PATCH] [Dy2St]Fix cascade_rcnn export model problem (#6468) * [Dy2St]Fix cascade_rcnn export model problem * [Dy2St]Fix cascade_rcnn export model problem --- ppdet/modeling/heads/cascade_head.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ppdet/modeling/heads/cascade_head.py b/ppdet/modeling/heads/cascade_head.py index 9a964e4e0..0498a35da 100644 --- a/ppdet/modeling/heads/cascade_head.py +++ b/ppdet/modeling/heads/cascade_head.py @@ -300,6 +300,12 @@ class CascadeHead(BBoxHead): num_prop = [] for p in proposals: num_prop.append(p.shape[0]) + + # NOTE(dev): num_prob will be tagged as LoDTensorArray because it + # depends on batch_size under @to_static. However the argument + # num_or_sections in paddle.split does not support LoDTensorArray, + # so we use [-1] to replace it and whitout lossing correctness. + num_prop = [-1] if len(num_prop) == 1 else num_prop return pred_bbox.split(num_prop) def get_prediction(self, head_out_list): -- GitLab