From 0f3aa74d11140642315e5303709d09a7d847e8e6 Mon Sep 17 00:00:00 2001 From: seiriosPlus Date: Sun, 15 Jul 2018 17:19:57 +0800 Subject: [PATCH] fix split_var=False --- python/paddle/fluid/transpiler/distribute_transpiler.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/paddle/fluid/transpiler/distribute_transpiler.py b/python/paddle/fluid/transpiler/distribute_transpiler.py index 416d03a4d3f..b0e9a659973 100644 --- a/python/paddle/fluid/transpiler/distribute_transpiler.py +++ b/python/paddle/fluid/transpiler/distribute_transpiler.py @@ -31,6 +31,7 @@ Steps to transpile pserver: from __future__ import print_function import math +import random import numpy as np from ps_dispatcher import RoundRobin, HashName, PSDispatcher @@ -196,6 +197,9 @@ class DistributeTranspiler(object): # fc_b@GRAD_trainer_0, fc_b@GRAD_trainer_1 --> pserver2 # shuffle the map will avoid the uneven distribution above grad_var_mapping_items = self.grad_var_mapping.items() + if not slice_var_up: + random.seed(self.trainer_num) + random.shuffle(grad_var_mapping_items) for orig_varname, splited_vars in grad_var_mapping_items: eplist = ps_dispatcher.dispatch(splited_vars) -- GitLab