reduce_sum 输出值问题
Created by: TWLemontree
with dygraph.guard():
x = fluid.layers.ones((128, 3, 28, 28), dtype='float32')
xi = fluid.layers.reshape(x, shape=(x.shape[0], -1, 3, x.shape[2], x.shape[3]))
xi2 = fluid.layers.reduce_sum(fluid.layers.square(xi), dim=2)
print(xi2)
我在复现别人的代码时,用到了这样一段代码。xi2 本来应该输出元素全为 3 的张量,但不知道为什么值全部为 0 !这给我造成了极大地困惑qwq