MCPcopy Create free account
hub / github.com/baidu/lac / test_process

Function test_process

python/LAC/nets.py:246–273  ·  view source on GitHub ↗

执行测试过程 Args: exe: 执行空间,即CPU和GPU program: 用于测试用的program reader: PyReader类型,读取数据 Returns:

(exe, program, reader, test_ret)

Source from the content-addressed store, hash-verified

244
245
246def test_process(exe, program, reader, test_ret):
247 """执行测试过程
248
249 Args:
250 exe: 执行空间,即CPU和GPU
251 program: 用于测试用的program
252 reader: PyReader类型,读取数据
253
254 Returns:
255
256 """
257 test_ret["chunk_evaluator"].reset()
258 for data in reader():
259 nums_infer, nums_label, nums_correct = exe.run(
260 program,
261 fetch_list=[
262 test_ret["num_infer_chunks"],
263 test_ret["num_label_chunks"],
264 test_ret["num_correct_chunks"],
265 ],
266 feed=data,
267 )
268
269 test_ret["chunk_evaluator"].update(
270 nums_infer, nums_label, nums_correct)
271 precision, recall, f1 = test_ret["chunk_evaluator"].eval()
272 print("[test] P: %.5f, R: %.5f, F1: %.5f"
273 % (precision, recall, f1))
274
275
276def do_train(args, dataset, segment_tool):

Callers 1

do_trainFunction · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected