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

Commit 66e9125

Browse files
author
wopeizl
authored
Merge pull request #666 from wopeizl/windows/fix04
fix the word2ver on windows test=develop
2 parents 2ef9e28 + 54b5809 commit 66e9125

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
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 = [[211]] # 'among'
192-
data2 = [[6]] # 'a'
193-
data3 = [[96]] # 'group'
194-
data4 = [[4]] # 'of'
195-
lod = [[1]]
191+
data1 = [[211L]] # 'among'
192+
data2 = [[6L]] # 'a'
193+
data3 = [[96L]] # 'group'
194+
data4 = [[4L]] # 'of'
195+
lod = [[1L]]
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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,26 +271,26 @@ 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([[1]], [[1]], place)
274+
user_id = fluid.create_lod_tensor([[1L]], [[1]], place)
275275

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

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

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

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

288288
assert feed_target_names[5] == "category_id"
289-
category_id = fluid.create_lod_tensor([[10, 8, 9]], [[3]], place)
289+
category_id = fluid.create_lod_tensor([[10L, 8L, 9L]], [[3]], place)
290290

291291
assert feed_target_names[6] == "movie_title"
292-
movie_title = fluid.create_lod_tensor([[1069, 4140, 2923, 710, 988]],
293-
[[5]], place)
292+
movie_title = fluid.create_lod_tensor(
293+
[[1069L, 4140L, 2923L, 710L, 988L]], [[5]], place)
294294

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

06.understand_sentiment/train_conv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def infer(use_cuda, params_dirname=None):
185185
UNK = word_dict['<unk>']
186186
lod = []
187187
for c in reviews:
188-
lod.append([word_dict.get(words, UNK) for words in c])
188+
lod.append([np.int64(word_dict.get(words, UNK)) for words in c])
189189

190190
base_shape = [[len(c) for c in lod]]
191191

06.understand_sentiment/train_dyn_rnn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def infer(use_cuda, params_dirname=None):
197197
UNK = word_dict['<unk>']
198198
lod = []
199199
for c in reviews:
200-
lod.append([word_dict.get(words, UNK) for words in c])
200+
lod.append([np.int64(word_dict.get(words, UNK)) for words in c])
201201

202202
base_shape = [[len(c) for c in lod]]
203203

06.understand_sentiment/train_stacked_lstm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def infer(use_cuda, params_dirname=None):
195195
UNK = word_dict['<unk>']
196196
lod = []
197197
for c in reviews:
198-
lod.append([word_dict.get(words, UNK) for words in c])
198+
lod.append([np.int64(word_dict.get(words, UNK)) for words in c])
199199

200200
base_shape = [[len(c) for c in lod]]
201201

0 commit comments

Comments
 (0)