Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Commit b170a71

Browse files
author
wopeizl
authored
Merge pull request #667 from wopeizl/fixbug
fix on python3 test=develop
2 parents 66e9125 + 6138fc7 commit b170a71

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

04.word2vec/train.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ def infer(use_cuda, params_dirname=None):
188188
# meaning there is only one level of detail and there is only one sequence of
189189
# one word on this level.
190190
# Note that recursive_sequence_lengths should be a list of lists.
191-
data1 = [[211L]] # 'among'
192-
data2 = [[6L]] # 'a'
193-
data3 = [[96L]] # 'group'
194-
data4 = [[4L]] # 'of'
195-
lod = [[1L]]
191+
data1 = [[numpy.int64(211)]] # 'among'
192+
data2 = [[numpy.int64(6)]] # 'a'
193+
data3 = [[numpy.int64(96)]] # 'group'
194+
data4 = [[numpy.int64(4)]] # 'of'
195+
lod = [[numpy.int64(1)]]
196196

197197
first_word = fluid.create_lod_tensor(data1, lod, place)
198198
second_word = fluid.create_lod_tensor(data2, lod, place)

05.recommender_system/train.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,26 +271,28 @@ def infer(use_cuda, params_dirname):
271271
# Correspondingly, recursive_sequence_lengths = [[3, 2]] contains one
272272
# level of detail info, indicating that `data` consists of two sequences
273273
# of length 3 and 2, respectively.
274-
user_id = fluid.create_lod_tensor([[1L]], [[1]], place)
274+
user_id = fluid.create_lod_tensor([[np.int64(1)]], [[1]], place)
275275

276276
assert feed_target_names[1] == "gender_id"
277-
gender_id = fluid.create_lod_tensor([[1L]], [[1]], place)
277+
gender_id = fluid.create_lod_tensor([[np.int64(1)]], [[1]], place)
278278

279279
assert feed_target_names[2] == "age_id"
280-
age_id = fluid.create_lod_tensor([[0L]], [[1]], place)
280+
age_id = fluid.create_lod_tensor([[np.int64(0)]], [[1]], place)
281281

282282
assert feed_target_names[3] == "job_id"
283-
job_id = fluid.create_lod_tensor([[10L]], [[1]], place)
283+
job_id = fluid.create_lod_tensor([[np.int64(10)]], [[1]], place)
284284

285285
assert feed_target_names[4] == "movie_id"
286-
movie_id = fluid.create_lod_tensor([[783L]], [[1]], place)
286+
movie_id = fluid.create_lod_tensor([[np.int64(783)]], [[1]], place)
287287

288288
assert feed_target_names[5] == "category_id"
289-
category_id = fluid.create_lod_tensor([[10L, 8L, 9L]], [[3]], place)
289+
category_id = fluid.create_lod_tensor(
290+
[np.array([10, 8, 9], dtype='int64')], [[3]], place)
290291

291292
assert feed_target_names[6] == "movie_title"
292293
movie_title = fluid.create_lod_tensor(
293-
[[1069L, 4140L, 2923L, 710L, 988L]], [[5]], place)
294+
[np.array([1069, 4140, 2923, 710, 988], dtype='int64')], [[5]],
295+
place)
294296

295297
# Construct feed as a dictionary of {feed_target_name: feed_target_data}
296298
# and results will contain a list of data corresponding to fetch_targets.

0 commit comments

Comments
 (0)