From 8aeacbe00c3072e5337b3f2c66ab0fa821581d69 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 3a0bbeb0fa341..abc84be12b38f 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')