From 37f90f5a5b00f68d4cdaaaee783ccd1044b64d5a Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Mon, 16 Apr 2018 16:13:26 +0800 Subject: [PATCH] Use var --- fluid/neural_machine_translation/transformer/train.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fluid/neural_machine_translation/transformer/train.py b/fluid/neural_machine_translation/transformer/train.py index 4b10c26e..c02012b7 100644 --- a/fluid/neural_machine_translation/transformer/train.py +++ b/fluid/neural_machine_translation/transformer/train.py @@ -202,7 +202,7 @@ def main(): tensor = position_encoding_init(ModelHyperParams.max_length + 1, ModelHyperParams.d_model) for place_id in xrange(dev_count): local_scope = train_exe.executor.local_scope(place_id) - local_scope.find_var(pos_enc_param_name).get_tensor().set(tensor, fluid.CUDAPlace(place_id)) + local_scope.var(pos_enc_param_name).get_tensor().set(tensor, fluid.CUDAPlace(place_id)) train_data = read_multiple(reader=train_data, count=dev_count) for pass_id in xrange(TrainTaskConfig.pass_num): @@ -221,12 +221,12 @@ def main(): fluid.CUDAPlace(place_id)) for var_name in data_input_dict: - local_scope.find_var(var_name).get_tensor().set(data_input_dict[var_name], + local_scope.var(var_name).get_tensor().set(data_input_dict[var_name], fluid.CUDAPlace(place_id)) for var_name in util_input_dict: print var_name, local_scope.find_var(var_name) - local_scope.find_var(var_name).get_tensor().set(util_input_dict[var_name], + local_scope.var(var_name).get_tensor().set(util_input_dict[var_name], fluid.CUDAPlace(place_id)) outs = train_exe.run(fetch_list=[sum_cost.name, token_num.name]) -- GitLab