未验证 提交 a71cfd8c 编写于 作者: L Li Min 提交者: GitHub

fix dygraph bugs in broadcast_to api. (#44612)

上级 15c0c9d2
...@@ -3000,8 +3000,10 @@ def broadcast_to(x, shape, name=None): ...@@ -3000,8 +3000,10 @@ def broadcast_to(x, shape, name=None):
print(out) print(out)
# [[1, 2, 3], [1, 2, 3]] # [[1, 2, 3], [1, 2, 3]]
""" """
if paddle.in_dynamic_mode(): if in_dygraph_mode():
return _C_ops.final_state_expand(x, shape) return _C_ops.final_state_expand(x, shape)
if _in_legacy_dygraph():
return _C_ops.expand_v2(x, 'shape', shape)
if isinstance(shape, Variable): if isinstance(shape, Variable):
assert len(shape.shape) == 1, ('shape must be an 1-D Tensor.') assert len(shape.shape) == 1, ('shape must be an 1-D Tensor.')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册