Skip to content

Commit 0abfbd1

Browse files
authored
Merge pull request #12748 from velconia/port_pybind11
Port print_function and make more efficient
2 parents 340a104 + 1ef5f2c commit 0abfbd1

File tree

374 files changed

+776
-42
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

374 files changed

+776
-42
lines changed

python/paddle/dataset/cifar.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
2929
"""
3030

31+
from __future__ import print_function
32+
3133
import itertools
3234
import numpy
3335
import paddle.dataset.common

python/paddle/dataset/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from __future__ import print_function
16+
1517
import requests
1618
import hashlib
1719
import os

python/paddle/dataset/conll05.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
to initialize SRL model.
2121
"""
2222

23+
from __future__ import print_function
24+
2325
import tarfile
2426
import gzip
2527
import itertools

python/paddle/dataset/flowers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
http://www.robots.ox.ac.uk/~vgg/publications/papers/nilsback08.{pdf,ps.gz}.
2929
3030
"""
31+
32+
from __future__ import print_function
33+
3134
import itertools
3235
import functools
3336
from .common import download
@@ -117,7 +120,7 @@ def reader():
117120
file = file.strip()
118121
batch = None
119122
with open(file, 'rb') as f:
120-
batch = pickle.loads(f.read())
123+
batch = pickle.load(f)
121124
data = batch['data']
122125
labels = batch['label']
123126
for sample, label in zip(data, batch['label']):

python/paddle/dataset/image.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
formats can be used for training. Noted that, the format should
3030
be keep consistent between the training and inference peroid.
3131
"""
32+
33+
from __future__ import print_function
34+
3235
import numpy as np
3336
try:
3437
import cv2

python/paddle/dataset/imdb.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
Besides, this module also provides API for building dictionary.
2121
"""
2222

23+
from __future__ import print_function
24+
2325
import paddle.dataset.common
2426
import collections
2527
import tarfile

python/paddle/dataset/imikolov.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
http://www.fit.vutbr.cz/~imikolov/rnnlm/ and parse training set and test set
1919
into paddle reader creators.
2020
"""
21+
22+
from __future__ import print_function
23+
2124
import paddle.dataset.common
2225
import collections
2326
import tarfile

python/paddle/dataset/mnist.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
This module will download dataset from http://yann.lecun.com/exdb/mnist/ and
1818
parse training set and test set into paddle reader creators.
1919
"""
20+
21+
from __future__ import print_function
22+
2023
import paddle.dataset.common
2124
import subprocess
2225
import numpy

python/paddle/dataset/movielens.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
2323
"""
2424

25+
from __future__ import print_function
26+
2527
import zipfile
2628
import paddle.dataset.common
2729
import re

python/paddle/dataset/mq2007.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
2424
"""
2525

26+
from __future__ import print_function
27+
2628
import os
2729
import functools
2830
import rarfile

0 commit comments

Comments
 (0)