提交 90988fbe 编写于 作者: J JiabinYang

Revert "refine the comments and the inference result format"

This reverts commit 7079f1bf.
上级 5829bd37
......@@ -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])
```
## 总结
......
01.fit_a_line/image/ranges.png

6.6 KB | W: | H:

01.fit_a_line/image/ranges.png

6.5 KB | W: | H:

01.fit_a_line/image/ranges.png
01.fit_a_line/image/ranges.png
01.fit_a_line/image/ranges.png
01.fit_a_line/image/ranges.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -221,7 +221,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
......@@ -232,11 +232,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)
......@@ -296,9 +296,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])
```
## 总结
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册