From b3584a73e1df136b38e50aeceb7bdb02d172bf27 Mon Sep 17 00:00:00 2001 From: chengduoZH Date: Tue, 12 Dec 2017 18:36:17 +0800 Subject: [PATCH] fix paddle/understand_sentiment_dynamic_lstm.py (the size of last batch is smaller than batch_size ) --- paddle/understand_sentiment_dynamic_lstm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddle/understand_sentiment_dynamic_lstm.py b/paddle/understand_sentiment_dynamic_lstm.py index b60efb8..4782380 100644 --- a/paddle/understand_sentiment_dynamic_lstm.py +++ b/paddle/understand_sentiment_dynamic_lstm.py @@ -128,7 +128,7 @@ def run_benchmark(model, args): tensor_words = to_lodtensor(map(lambda x: x[0], data), place) label = np.array(map(lambda x: x[1], data)).astype("int64") - label = label.reshape([args.batch_size, 1]) + label = label.reshape([len(data), 1]) tensor_label = fluid.LoDTensor() tensor_label.set(label, place)