adapt test_collective_base.py for only two GPU cards available. (#21307)

* adapt test_collective_base.py for only two GPU cards available.
test=develop

* fix bug of issue #21259
test=develop
revert-21172-masked_select_api
Yi Liu 6 years ago committed by GitHub
parent ed2a185248
commit f1b09ba30e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -104,16 +104,16 @@ def one_hot(input, depth, allow_out_of_range=False):
if in_dygraph_mode(): if in_dygraph_mode():
inputs = {'X': input} inputs = {'X': input}
attrs = {'depth': depth} attrs = {'depth': depth, 'allow_out_of_range': allow_out_of_range}
else: else:
if not isinstance(depth, Variable): if not isinstance(depth, Variable):
# user attribute # user attribute
inputs = {'X': input} inputs = {'X': input}
attrs = {'depth': depth} attrs = {'depth': depth, 'allow_out_of_range': allow_out_of_range}
else: else:
depth.stop_gradient = True depth.stop_gradient = True
inputs = {'X': input, 'depth_tensor': depth} inputs = {'X': input, 'depth_tensor': depth}
attrs = {} attrs = {'allow_out_of_range': allow_out_of_range}
helper.append_op( helper.append_op(
type="one_hot_v2", type="one_hot_v2",
inputs=inputs, inputs=inputs,

@ -163,7 +163,7 @@ class TestDistBase(unittest.TestCase):
w0_ep, w1_ep = worker_endpoints w0_ep, w1_ep = worker_endpoints
#print("w0_ep:",w0_ep," w1_ep:",w1_ep) #print("w0_ep:",w0_ep," w1_ep:",w1_ep)
env0 = { env0 = {
"FLAGS_selected_gpus": "2", "FLAGS_selected_gpus": "0",
"PADDLE_TRAINER_ID": "0", "PADDLE_TRAINER_ID": "0",
"PADDLE_TRAINERS_NUM": "2", "PADDLE_TRAINERS_NUM": "2",
"PADDLE_TRAINER_ENDPOINTS": self._ps_endpoints, "PADDLE_TRAINER_ENDPOINTS": self._ps_endpoints,
@ -171,7 +171,7 @@ class TestDistBase(unittest.TestCase):
} }
env1 = { env1 = {
"FLAGS_selected_gpus": "3", "FLAGS_selected_gpus": "1",
"PADDLE_TRAINER_ID": "1", "PADDLE_TRAINER_ID": "1",
"PADDLE_TRAINERS_NUM": "2", "PADDLE_TRAINERS_NUM": "2",
"PADDLE_TRAINER_ENDPOINTS": self._ps_endpoints, "PADDLE_TRAINER_ENDPOINTS": self._ps_endpoints,

Loading…
Cancel
Save