未验证 提交 88aa2d8a 编写于 作者: S Siddharth Goyal 提交者: GitHub

Fix order of inputs in infer() of label_semantic example (#10993)

上级 580340ee
...@@ -217,8 +217,6 @@ def infer(use_cuda, inference_program, params_dirname): ...@@ -217,8 +217,6 @@ def infer(use_cuda, inference_program, params_dirname):
# The range of random integers is [low, high] # The range of random integers is [low, high]
word = fluid.create_random_int_lodtensor( word = fluid.create_random_int_lodtensor(
lod, base_shape, place, low=0, high=WORD_DICT_LEN - 1) lod, base_shape, place, low=0, high=WORD_DICT_LEN - 1)
pred = fluid.create_random_int_lodtensor(
lod, base_shape, place, low=0, high=PRED_DICT_LEN - 1)
ctx_n2 = fluid.create_random_int_lodtensor( ctx_n2 = fluid.create_random_int_lodtensor(
lod, base_shape, place, low=0, high=WORD_DICT_LEN - 1) lod, base_shape, place, low=0, high=WORD_DICT_LEN - 1)
ctx_n1 = fluid.create_random_int_lodtensor( ctx_n1 = fluid.create_random_int_lodtensor(
...@@ -229,18 +227,20 @@ def infer(use_cuda, inference_program, params_dirname): ...@@ -229,18 +227,20 @@ def infer(use_cuda, inference_program, params_dirname):
lod, base_shape, place, low=0, high=WORD_DICT_LEN - 1) lod, base_shape, place, low=0, high=WORD_DICT_LEN - 1)
ctx_p2 = fluid.create_random_int_lodtensor( ctx_p2 = fluid.create_random_int_lodtensor(
lod, base_shape, place, low=0, high=WORD_DICT_LEN - 1) lod, base_shape, place, low=0, high=WORD_DICT_LEN - 1)
pred = fluid.create_random_int_lodtensor(
lod, base_shape, place, low=0, high=PRED_DICT_LEN - 1)
mark = fluid.create_random_int_lodtensor( mark = fluid.create_random_int_lodtensor(
lod, base_shape, place, low=0, high=MARK_DICT_LEN - 1) lod, base_shape, place, low=0, high=MARK_DICT_LEN - 1)
results = inferencer.infer( results = inferencer.infer(
{ {
'word_data': word, 'word_data': word,
'verb_data': pred,
'ctx_n2_data': ctx_n2, 'ctx_n2_data': ctx_n2,
'ctx_n1_data': ctx_n1, 'ctx_n1_data': ctx_n1,
'ctx_0_data': ctx_0, 'ctx_0_data': ctx_0,
'ctx_p1_data': ctx_p1, 'ctx_p1_data': ctx_p1,
'ctx_p2_data': ctx_p2, 'ctx_p2_data': ctx_p2,
'verb_data': pred,
'mark_data': mark 'mark_data': mark
}, },
return_numpy=False) return_numpy=False)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册