diff --git a/ppdet/modeling/heads/cascade_head.py b/ppdet/modeling/heads/cascade_head.py index 9a964e4e083e07f14ca297b1a65510432a7ae01e..0498a35da5ce4952739245ba0426a1ac306bf2e3 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):