From eb28a36dea3998afababbd76803c7e2f8de7ea0b Mon Sep 17 00:00:00 2001 From: wuhuachaocoding <77733235+wuhuachaocoding@users.noreply.github.com> Date: Fri, 24 Sep 2021 14:41:59 +0800 Subject: [PATCH] concat api support empty tensor. (#35845) --- python/paddle/fluid/layers/tensor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/paddle/fluid/layers/tensor.py b/python/paddle/fluid/layers/tensor.py index 3a0bbeb0fa3..abc84be12b3 100644 --- a/python/paddle/fluid/layers/tensor.py +++ b/python/paddle/fluid/layers/tensor.py @@ -322,6 +322,8 @@ def concat(input, axis=0, name=None): if isinstance(axis, Variable): axis = axis.numpy() axis = axis.item(0) + if not isinstance(input, Variable): + input = [t for t in input if t.shape.count(0) == 0] return _C_ops.concat(input, 'axis', axis) check_type(input, 'input', (list, tuple, Variable), 'concat') -- GitLab