quickstart_en.rst 1.5 KB
Newer Older
T
tangwei12 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
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

If you need to install GPU version (cuda7.5_cudnn5_avx_openblas), run:

  .. 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
34
  
T
tangwei12 已提交
35
     with fluid.scope_guard(fluid.core.Scope()):
36 37 38
         # initialize executor with cpu
         exe = fluid.Executor(place=fluid.CPUPlace())
         # load inference model 
T
tangwei12 已提交
39
         [inference_program, feed_target_names,fetch_targets] =  \
40 41 42 43 44 45 46
             fluid.io.load_inference_model(uci_housing.fluid_model(), exe)
         # run inference
         result = exe.run(inference_program, 
                          feed={feed_target_names[0]: uci_housing.predict_reader()}, 
                          fetch_list=fetch_targets)
         # print predicted price is $12,273.97 
         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.