未验证 提交 c894d91d 编写于 作者: W Wen Sun 提交者: GitHub

Fix cannot import `paddle.distributed` in python 3.6 on release/2.4 (#47141)

* fix: fix incorrect import

* fix: fix incorrect usage
上级 90b31790
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle.distributed.collective as collective
import paddle.fluid.framework as framework import paddle.fluid.framework as framework
from paddle.distributed import collective
def _recv_in_dygraph(tensor, src, group, sync_op, use_calc_stream): def _recv_in_dygraph(tensor, src, group, sync_op, use_calc_stream):
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
import paddle import paddle
import paddle.distributed as dist
import paddle.fluid.framework as framework import paddle.fluid.framework as framework
from paddle.distributed.communication.group import _get_global_group from paddle.distributed.communication.group import _get_global_group
from paddle.distributed.communication.reduce import _get_reduce_op, ReduceOp from paddle.distributed.communication.reduce import _get_reduce_op, ReduceOp
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
import paddle import paddle
import paddle.distributed as dist
import paddle.fluid.framework as framework import paddle.fluid.framework as framework
from paddle.distributed import collective from paddle.distributed import collective
...@@ -44,7 +43,7 @@ def _scatter_tensor_in_dygraph(out_tensor, in_tensor, src, group, sync_op, ...@@ -44,7 +43,7 @@ def _scatter_tensor_in_dygraph(out_tensor, in_tensor, src, group, sync_op,
raise RuntimeError("Src rank out of group.") raise RuntimeError("Src rank out of group.")
nranks = group.nranks nranks = group.nranks
rank = dist.get_rank() rank = paddle.distributed.get_rank()
if rank == src_rank: if rank == src_rank:
_check_tensor_shape(out_tensor, in_tensor.shape, nranks) _check_tensor_shape(out_tensor, in_tensor.shape, nranks)
...@@ -69,7 +68,7 @@ def _scatter_in_dygraph(tensor, tensor_list, src, group, sync_op, ...@@ -69,7 +68,7 @@ def _scatter_in_dygraph(tensor, tensor_list, src, group, sync_op,
raise RuntimeError("Src rank out of group.") raise RuntimeError("Src rank out of group.")
nranks = group.nranks nranks = group.nranks
rank = dist.get_rank() rank = paddle.distributed.get_rank()
if rank == src_rank: if rank == src_rank:
if len(tensor_list) == 0: if len(tensor_list) == 0:
raise RuntimeError( raise RuntimeError(
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle.distributed.collective as collective
import paddle.fluid.framework as framework import paddle.fluid.framework as framework
from paddle.distributed import collective
def _send_in_dygraph(tensor, dst, group, sync_op, use_calc_stream): def _send_in_dygraph(tensor, dst, group, sync_op, use_calc_stream):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册