Skip to content

Commit 68b2d09

Browse files
committed
inference
1 parent 6cf6e25 commit 68b2d09

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

doc/fluid/howto/inference/inference_support_in_fluid.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# Fluid Inference使用指南
22

3+
## 目录:
4+
35
- Python Inference API
46
- 编译Fluid Inference库
57
- Inference C++ API
68
- Inference实例
79
- Inference计算优化
810

911
## Python Inference API **[改进中]**
10-
- [保存Inference模型](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/io.py#L295)
12+
- 保存Inference模型 ([链接](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/io.py#L295))
1113

1214
```python
1315
def save_inference_model(dirname,
@@ -43,7 +45,7 @@
4345
$ ls
4446
$ __model__ __params__
4547
```
46-
- [加载Inference模型](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/io.py#L380)
48+
- 加载Inference模型([链接](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/io.py#L380))
4749
```python
4850
def load_inference_model(dirname,
4951
executor,
@@ -110,7 +112,7 @@
110112

111113

112114
## 链接Fluid Inference库
113-
- [示例项目](https://github.com/luotao1/fluid_inference_example.git)
115+
- 示例项目([链接](https://github.com/luotao1/fluid_inference_example.git))
114116

115117
- GCC配置
116118
```bash
@@ -143,7 +145,7 @@
143145

144146
## C++ Inference API
145147

146-
- [推断流程](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/inference/tests/test_helper.h#L91)
148+
- 推断流程([链接](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/inference/tests/test_helper.h#L91))
147149

148150
- 1、 初始化设备
149151
```cpp
@@ -242,7 +244,7 @@
242244
243245
244246
- **不在每次执行时创建和销毁变量
245-
[PR](https://github.com/PaddlePaddle/Paddle/pull/9301)**
247+
([PR](https://github.com/PaddlePaddle/Paddle/pull/9301))**
246248
- 执行`inference_program`
247249
```cpp
248250
// Call once
@@ -259,7 +261,7 @@
259261
- 在同一个`Scope`中,相同的变量名是公用同一块内存的,容易引起意想不到的错误
260262
261263
262-
- **不在每次执行时创建Op [PR](https://github.com/PaddlePaddle/Paddle/pull/9630)**
264+
- **不在每次执行时创建Op([PR](https://github.com/PaddlePaddle/Paddle/pull/9630))**
263265
- 执行`inference_program`
264266
```cpp
265267
// Call once
@@ -273,7 +275,7 @@
273275
- 一旦修改了`inference_program`,则需要重新创建`ctx`
274276
275277
276-
- **[多线程共享Parameters](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/inference/tests/test_multi_thread_helper.h)**
278+
- **多线程共享Parameters([链接](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/inference/tests/test_multi_thread_helper.h))**
277279
- 主线程
278280
- 1、 初始化设备
279281
- 2、 定义`place``executor``scope`
@@ -310,9 +312,9 @@
310312
- CPUPlace,CPU设备
311313
- CUDAPlace,CUDA GPU设备
312314
- 神经网络表示:
313-
- [Program](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/fluid/design/concepts/program.md)
315+
- [Program](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/fluid/design/concepts/program.md).
314316
315-
详细介绍请参考[**Paddle Fluid开发者指南**](https://github.com/lcy-seso/learning_notes/blob/master/Fluid/developer's_guid_for_Fluid/Developer's_Guide_to_Paddle_Fluid.md)
317+
详细介绍请参考[**Paddle Fluid开发者指南**](https://github.com/lcy-seso/learning_notes/blob/master/Fluid/developer's_guid_for_Fluid/Developer's_Guide_to_Paddle_Fluid.md)
316318
317319
318320
@@ -328,7 +330,7 @@
328330
329331
330332
## Inference计算优化
331-
- 使用Python推理优化工具[inference_transpiler](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/inference_transpiler.py)
333+
- 使用Python推理优化工具([inference_transpiler](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/inference_transpiler.py))
332334
```python
333335
class InferenceTranspiler:
334336
def transpile(self, program, place, scope=None):
@@ -341,7 +343,7 @@
341343
- 使用`InferenceTranspiler`会修改参数的值,请确保`program`的参数在`scope`内。
342344
- 支持的优化
343345
- 融合batch_norm op的计算
344-
- [使用示例](https://github.com/Xreki/Xreki.github.io/blob/master/fluid/inference/inference_transpiler.py)
346+
- 使用示例([链接](https://github.com/Xreki/Xreki.github.io/blob/master/fluid/inference/inference_transpiler.py))
345347
```python
346348
import paddle.fluid as fluid
347349
# NOTE: Applying the inference transpiler will change the inference_program.
@@ -353,7 +355,7 @@
353355
354356
355357
## 内存使用优化
356-
- 使用Python内存优化工具[memory_optimization_transipiler](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/memory_optimization_transpiler.py)
358+
- 使用Python内存优化工具([memory_optimization_transipiler](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/memory_optimization_transpiler.py))
357359
```python
358360
fluid.memory_optimize(inference_program)
359361
```

0 commit comments

Comments
 (0)