quickstart_en.rst 1.5 KB
Newer Older
T
tangwei12 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Quick Start
============

Quick Install
-------------

You can use pip to install PaddlePaddle with a single command, supports
CentOS 6 above, Ubuntu 14.04 above or MacOS 10.12, with Python 2.7 installed.
Simply run the following command to install, the version is cpu_avx_openblas:

  .. code-block:: bash

     pip install paddlepaddle

W
weixing02 已提交
15
If you need to install GPU version (cuda8.0_cudnn5_avx_openblas), run:
T
tangwei12 已提交
16 17 18 19 20

  .. code-block:: bash

     pip install paddlepaddle-gpu

21
For more details about installation and build: :ref:`install_steps` .
T
tangwei12 已提交
22 23 24 25 26 27 28 29 30

Quick Use
---------

Create a new file called housing.py, and paste this Python
code:


  .. code-block:: python
31 32

     import paddle.dataset.uci_housing as uci_housing
T
tangwei12 已提交
33
     import paddle.fluid as fluid
W
weixing02 已提交
34

T
tangwei12 已提交
35
     with fluid.scope_guard(fluid.core.Scope()):
36 37
         # initialize executor with cpu
         exe = fluid.Executor(place=fluid.CPUPlace())
W
weixing02 已提交
38
         # load inference model
T
tangwei12 已提交
39
         [inference_program, feed_target_names,fetch_targets] =  \
40 41
             fluid.io.load_inference_model(uci_housing.fluid_model(), exe)
         # run inference
W
weixing02 已提交
42 43
         result = exe.run(inference_program,
                          feed={feed_target_names[0]: uci_housing.predict_reader()},
44
                          fetch_list=fetch_targets)
W
weixing02 已提交
45
         # print predicted price is $12,273.97
46
         print 'Predicted price: ${:,.2f}'.format(result[0][0][0] * 1000)
T
tangwei12 已提交
47

T
tangwei12 已提交
48 49
Run :code:`python housing.py` and voila! It should print out a list of predictions
for the test housing data.