diff --git a/PaddleRec/ssr/infer.py b/PaddleRec/ssr/infer.py index 4dec0c0d0a09709c76da237445372f3d982e8f8c..09dee039f4da1e08de0169b3370aff174c89556b 100644 --- a/PaddleRec/ssr/infer.py +++ b/PaddleRec/ssr/infer.py @@ -95,7 +95,7 @@ def infer(args, vocab_size, test_reader): user_data, pos_label = utils.infer_data(data, place) all_item_numpy = np.tile( np.arange(vocab_size), len(pos_label)).reshape( - len(pos_label), vocab_size, 1) + len(pos_label), vocab_size, 1).astype("int64") para = exe.run(copy_program, feed={ "user": user_data, diff --git a/PaddleRec/word2vec/infer.py b/PaddleRec/word2vec/infer.py index 26a1f2215e96d3c8ee325040f4c76ff93b8a6656..1b3290029d620d130d2fe7b7c2bcfd8bbeae54c2 100644 --- a/PaddleRec/word2vec/infer.py +++ b/PaddleRec/word2vec/infer.py @@ -88,17 +88,17 @@ def infer_epoch(args, vocab_size, test_reader, use_cuda, i2w): label = [dat[3] for dat in data] input_word = [dat[4] for dat in data] - para = exe.run( - copy_program, - feed={ - "analogy_a": wa, - "analogy_b": wb, - "analogy_c": wc, - "all_label": - np.arange(vocab_size).reshape(vocab_size, 1), - }, - fetch_list=[pred.name, values], - return_numpy=False) + para = exe.run(copy_program, + feed={ + "analogy_a": wa, + "analogy_b": wb, + "analogy_c": wc, + "all_label": + np.arange(vocab_size).reshape( + vocab_size, 1).astype("int64"), + }, + fetch_list=[pred.name, values], + return_numpy=False) pre = np.array(para[0]) val = np.array(para[1]) for ii in range(len(label)):