From 90988fbe9e7155f2fe0dac1776b38da5449d4743 Mon Sep 17 00:00:00 2001 From: JiabinYang Date: Sat, 14 Jul 2018 04:05:38 +0000 Subject: [PATCH] Revert "refine the comments and the inference result format" This reverts commit 7079f1bf5c101a5a27cb027d6e58d90c9fb3ebc1. --- 01.fit_a_line/README.cn.md | 10 ++++------ 01.fit_a_line/image/ranges.png | Bin 6737 -> 6668 bytes 01.fit_a_line/index.cn.html | 10 ++++------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/01.fit_a_line/README.cn.md b/01.fit_a_line/README.cn.md index e554770..936142b 100644 --- a/01.fit_a_line/README.cn.md +++ b/01.fit_a_line/README.cn.md @@ -179,7 +179,7 @@ feed_order=['x', 'y'] 除此之外,可以定义一个事件相应器来处理类似`打印训练进程`的事件: ```python -# Specify the directory to save the parameters +# Specify the directory path to save the parameters params_dirname = "fit_a_line.inference.model" # Plot data @@ -190,11 +190,11 @@ plot_cost = Ploter(train_title, test_title) step = 0 -# event_handler prints training and testing info +# event_handler to print training and testing info def event_handler_plot(event): global step if isinstance(event, fluid.EndStepEvent): - if event.step % 10 == 0: # record the test cost every 10 seconds + if event.step % 10 == 0: # every 10 batches, record a test cost test_metrics = trainer.test( reader=test_reader, feed_order=feed_order) @@ -254,9 +254,7 @@ batch_size = 10 tensor_x = numpy.random.uniform(0, 10, [batch_size, 13]).astype("float32") results = inferencer.infer({'x': tensor_x}) -print("infer results: (House Price)") -for k in range(0, batch_size-1): - print("%d. %f" % (k, results[0][k])) +print("infer results: ", results[0]) ``` ## 总结 diff --git a/01.fit_a_line/image/ranges.png b/01.fit_a_line/image/ranges.png index 5325df4800985983e17476f007658d1cdb170b1c..5d86b12715f46afbafb7d50e2938e184219b5b95 100644 GIT binary patch delta 10 Rcmca;(ql5gV`J|TNdOwC1i1hJ delta 78 zcmeA%xo9%M!