提交 fbdd8fdb 编写于 作者: X xiaoting 提交者: Jiabin Yang

compatible with python3 (#792)

fix : http://newicafe.baidu.com:80/issue/DLTP-1929/show?from=page, fix book code is not compatible with python3
上级 41f50012
......@@ -176,11 +176,12 @@ Paddle API提供了自动加载cifar数据集模块 `paddle.dataset.cifar`。
让我们从导入 Paddle Fluid API 和辅助模块开始。
```python
from __future__ import print_function
import paddle
import paddle.fluid as fluid
import numpy
import sys
from __future__ import print_function
```
......
......@@ -170,11 +170,12 @@ After running the command `python train.py`, training will start immediately. Th
Let's start with importing the Paddle Fluid API package and the helper modules.
```python
from __future__ import print_function
import paddle
import paddle.fluid as fluid
import numpy
import sys
from __future__ import print_function
```
......
......@@ -218,11 +218,12 @@ Paddle API提供了自动加载cifar数据集模块 `paddle.dataset.cifar`。
让我们从导入 Paddle Fluid API 和辅助模块开始。
```python
from __future__ import print_function
import paddle
import paddle.fluid as fluid
import numpy
import sys
from __future__ import print_function
```
......
......@@ -212,11 +212,12 @@ After running the command `python train.py`, training will start immediately. Th
Let's start with importing the Paddle Fluid API package and the helper modules.
```python
from __future__ import print_function
import paddle
import paddle.fluid as fluid
import numpy
import sys
from __future__ import print_function
```
......
......@@ -236,14 +236,14 @@ dream that one day <e>
```python
from __future__ import print_function
import paddle as paddle
import paddle.fluid as fluid
import six
import numpy
import math
from __future__ import print_function
```
然后,定义参数:
......
......@@ -201,14 +201,14 @@ First, load packages:
```python
from __future__ import print_function
import paddle as paddle
import paddle.fluid as fluid
import six
import numpy
import math
from __future__ import print_function
```
Then, define the parameters:
......
......@@ -278,14 +278,14 @@ dream that one day <e>
```python
from __future__ import print_function
import paddle as paddle
import paddle.fluid as fluid
import six
import numpy
import math
from __future__ import print_function
```
然后,定义参数:
......
......@@ -243,14 +243,14 @@ First, load packages:
```python
from __future__ import print_function
import paddle as paddle
import paddle.fluid as fluid
import six
import numpy
import math
from __future__ import print_function
```
Then, define the parameters:
......
......@@ -87,6 +87,10 @@ DCGAN中的生成器(G)结构如下图所示:
首先加载 PaddlePaddle 的 Fluid 和其他相关包
```python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import matplotlib
......@@ -101,9 +105,6 @@ import paddle.fluid as fluid
matplotlib.use('agg')
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
```
### 定义辅助工具
......
......@@ -129,6 +129,10 @@ DCGAN中的生成器(G)结构如下图所示:
首先加载 PaddlePaddle 的 Fluid 和其他相关包
```python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import matplotlib
......@@ -143,9 +147,6 @@ import paddle.fluid as fluid
matplotlib.use('agg')
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
```
### 定义辅助工具
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册