From 9724d92a1a3628ee4aa1fcd2189fb796aa731d3e Mon Sep 17 00:00:00 2001 From: frankwhzhang Date: Fri, 30 Nov 2018 20:45:26 +0800 Subject: [PATCH] fix tagspace gpu num_devices bug --- fluid/PaddleRec/tagspace/net.py | 2 +- fluid/PaddleRec/tagspace/train.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fluid/PaddleRec/tagspace/net.py b/fluid/PaddleRec/tagspace/net.py index cbafb170..797ae634 100644 --- a/fluid/PaddleRec/tagspace/net.py +++ b/fluid/PaddleRec/tagspace/net.py @@ -46,4 +46,4 @@ def network(vocab_text_size, vocab_tag_size, emb_dim=10, hid_dim=1000, win_size= avg_cost = nn.mean(loss_part3) less = tensor.cast(cf.less_than(cos_neg, cos_pos), dtype='float32') correct = nn.reduce_sum(less) - return avg_cost, correct, cos_pos \ No newline at end of file + return avg_cost, correct, cos_pos diff --git a/fluid/PaddleRec/tagspace/train.py b/fluid/PaddleRec/tagspace/train.py index 7a2442d7..becb2a03 100644 --- a/fluid/PaddleRec/tagspace/train.py +++ b/fluid/PaddleRec/tagspace/train.py @@ -102,7 +102,7 @@ def train(): if batch_id % args.print_batch == 0: print("TRAIN --> pass: {} batch_num: {} avg_cost: {}, acc: {}" .format(pass_idx, (batch_id+10) * batch_size, np.mean(loss_val), - float(np.sum(correct_val)) / batch_size)) + float(np.sum(correct_val)) / (args.num_devices*batch_size))) t1 = time.time() total_time += t1 - t0 print("epoch:%d num_steps:%d time_cost(s):%f" % -- GitLab