提交 074d166d 编写于 作者: Z Zeyu Chen

migrate test to new export api

上级 fda184fd
......@@ -162,8 +162,6 @@ def train(use_cuda=False):
target_vars=[predict_word],
executor=exe)
create
dictionary = defaultdict(int)
w_id = 0
for w in word_dict:
......@@ -211,25 +209,18 @@ def test_save_module(use_cuda=False):
target_vars=[word_emb],
executor=exe)
dictionary = defaultdict(int)
w_id = 0
for w in word_dict:
if isinstance(w, bytes):
w = w.decode("ascii")
dictionary[w] = w_id
w_id += 1
signature = hub.create_singature(
"default", inputs=[data], outputs=[word_emb])
hub.create_module(
sign_arr=signature, program=main_program, path=save_module_dir)
# input_desc = {"words": words.name}
# output_desc = {"emb": word_emb.name}
# config = hub.ModuleConfig(saved_module_dir)
# config.register_feed_signature(input_desc, sign_name="default")
# config.register_fetch_signature(output_desc, sign_name="default")
# config.save_dict(word_dict=dictionary)
# config.dump()
dictionary = defaultdict(int)
w_id = 0
for w in word_dict:
if isinstance(w, bytes):
w = w.decode("ascii")
dictionary[w] = w_id
w_id += 1
signature = hub.create_signature(
"default", inputs=[words], outputs=[word_emb])
hub.create_module(
sign_arr=signature, program=main_program, path=saved_module_dir)
def test_load_module(use_cuda=False):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册