diff --git a/contrib/Python/cntk/examples/LogReg/logreg.py b/contrib/Python/cntk/examples/LogReg/logreg.py index fda06aa1e..c1a9a8278 100644 --- a/contrib/Python/cntk/examples/LogReg/logreg.py +++ b/contrib/Python/cntk/examples/LogReg/logreg.py @@ -49,9 +49,7 @@ def train_eval_logistic_regression_from_file(criterion_name=None, my_sgd = C.SGDParams( epoch_size=0, minibatch_size=25, learning_rates_per_mb=0.1, max_epochs=3) - with C.LocalExecutionContext('logreg') as ctx: - ctx.device_id = device_id - + with C.LocalExecutionContext('logreg', device_id=device_id, clean_up=True) as ctx: ctx.train( root_nodes=[ce, eval], training_params=my_sgd, diff --git a/contrib/Python/cntk/examples/LogReg/logreg_numpy.py b/contrib/Python/cntk/examples/LogReg/logreg_numpy.py index 28ff3ed77..8718b2d7d 100644 --- a/contrib/Python/cntk/examples/LogReg/logreg_numpy.py +++ b/contrib/Python/cntk/examples/LogReg/logreg_numpy.py @@ -69,9 +69,7 @@ def train_eval_logistic_regression_with_numpy(criterion_name=None, my_sgd = C.SGDParams(epoch_size=0, minibatch_size=25, learning_rates_per_mb=0.1, max_epochs=3) - with C.LocalExecutionContext('logreg', clean_up=True) as ctx: - ctx.device_id = device_id - + with C.LocalExecutionContext('logreg_numpy', device_id=device_id, clean_up=True) as ctx: ctx.train( root_nodes=[ce,eval], training_params=my_sgd)