Paddle
Paddle copied to clipboard
expand_as没有设置 output shape 么?
https://github.com/PaddlePaddle/Paddle/blob/a9520db24ef8b101514b0bcaff39dd359f72dcb7/paddle/fluid/operators/expand_as_op.cc#L48
问题已在用户群解决,发现,expand_asAPI返回的shape全是0,复现代码如下: paddle版本1.7
import paddle.fluid as fluid
from paddle.fluid.dygraph.base import to_variable
import numpy as np
pad_value = fluid.layers.assign(np.array([[2,3]]).astype(np.float32))
print(pad_value.shape)
tmp = fluid.layers.assign(np.ones([3, 2]).astype(np.float32))
print(tmp.shape)
res = fluid.layers.expand_as(x=pad_value, target_tensor=tmp)
print(res.shape)
打印结果 (1, 2) (3, 2) (0, 0)
问题已在用户群解决,发现,expand_asAPI返回的shape全是0,复现代码如下: paddle版本1.7
import paddle.fluid as fluid from paddle.fluid.dygraph.base import to_variable import numpy as np pad_value = fluid.layers.assign(np.array([[2,3]]).astype(np.float32)) print(pad_value.shape) tmp = fluid.layers.assign(np.ones([3, 2]).astype(np.float32)) print(tmp.shape) res = fluid.layers.expand_as(x=pad_value, target_tensor=tmp) print(res.shape)打印结果 (1, 2) (3, 2) (0, 0)
请问这个问题要怎么解决?
Since you haven't replied for more than a year, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. 由于您超过一年未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。