未验证 提交 e3223ad7 编写于 作者: F Feiyu Chan 提交者: GitHub

fix nce sample code for python3, test=develop (#25103)

fix nce sample code for python3 compatability.
上级 84f9b9ef
...@@ -725,7 +725,7 @@ def nce(input, ...@@ -725,7 +725,7 @@ def nce(input,
window_size = 5 window_size = 5
words = [] words = []
for i in xrange(window_size): for i in range(window_size):
words.append(fluid.data( words.append(fluid.data(
name='word_{0}'.format(i), shape=[-1, 1], dtype='int64')) name='word_{0}'.format(i), shape=[-1, 1], dtype='int64'))
...@@ -733,7 +733,7 @@ def nce(input, ...@@ -733,7 +733,7 @@ def nce(input,
label_word = int(window_size / 2) + 1 label_word = int(window_size / 2) + 1
embs = [] embs = []
for i in xrange(window_size): for i in range(window_size):
if i == label_word: if i == label_word:
continue continue
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册