PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
21.64k stars 5.44k forks source link

fix reshape_ when shape is inconsistent with dist_attr after infer global shape #63876

Closed zhiqiu closed 1 week ago

zhiqiu commented 1 week ago

PR Category

Auto Parallel

PR Types

Bug fixes

Description

ATT The following case raise Error as below,

a = paddle.rand([2, 8, 32])
dist_a = dist.shard_tensor(a, mesh, [dist.Shard(1)])
dist_a = paddle.reshape_(dist_a, [16, 32])
print(dist_a)

#####
InvalidArgumentError: The input dist_attr [{process_mesh: {shape: [2], process_ids: [0,1], dim_names: [x]}, dims_mappings: [-1,-1,-1], batch_dim: 0, chunk_id: 0, dynamic_dims: [0,0,0], annotated: [dims_mapping: 1,process_mesh: 1], partial: [].}] and dims [16,32] are improper.
  [Hint: Expected dist_attr.verify_dynamic(common::vectorize(dims)) == true, but received dist_attr.verify_dynamic(common::vectorize(dims)):0 != true:1.] (at /paddle/paddle/phi/core/distributed/auto_parallel/reshard/reshard_function.cc:51)

This PR fixes that.

Pcard-76459

paddle-bot[bot] commented 1 week ago

你的PR提交成功,感谢你对开源项目的贡献! 请关注后续CI自动化测试结果,详情请参考Paddle-CI手册。 Your PR has been submitted. Thanks for your contribution! Please wait for the result of CI firstly. See Paddle CI Manual for details.