concat行为不符合预期
Created by: chaos-dd
对两个tensor分别reduce_sum得到两个新的tensor,把两个新的tensor concat的时候,axis=1的时候直接等于第一个tensor,不符合预期,这里至少应报错。 试了下pytorch这种情况,sum后的tensor是dim=0的,不能concat。
`
import numpy as np import paddle.fluid as fluid
a=np.ones([2,2]) b=np.ones([2,2]) * 2
with fluid.dygraph.guard(): asum=fluid.layers.reduce_sum(fluid.dygraph.to_variable(a)) bsum=fluid.layers.reduce_sum(fluid.dygraph.to_variable(b)) c = fluid.layers.concat([asum, bsum], axis=0) d = fluid.layers.concat([asum, bsum], axis=1) print asum, bsum, c, d #asum=4 bsun=8, c=[4 8] d = 4
`