未验证 提交 8ab2b837 编写于 作者: X xiongkun 提交者: GitHub

fix dy2static, use isinstance to avoid TensorArray transform (#6877)

上级 9075408a
......@@ -304,8 +304,10 @@ class CascadeHead(BBoxHead):
# 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
# so we use [-1] to replace it if num_prop is not list. The modification
# This ensures the correctness of both dynamic and static graphs.
if not isinstance(num_prop, list):
num_prop = [-1]
return pred_bbox.split(num_prop)
def get_prediction(self, head_out_list):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册