Environnement d'exploitation
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 14.04 LTS desktop amd64
TensorFlow v0.11
cuDNN v5.1 for Linux
CUDA v8.0
Python 2.7.6
IPython 5.1.0 -- An enhanced Interactive Python.
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
J'essaye la vérification PEP8 du code écrit en Python. Référence http://qiita.com/clarinet758/items/312e95ee1513560dfdd1
Courir
$ pep8 read_chpoint.py | head
read_chpoint.py:20:1: E302 expected 2 blank lines, found 1
read_chpoint.py:21:1: E101 indentation contains mixed spaces and tabs
read_chpoint.py:21:1: W191 indentation contains tabs
...
La partie pertinente du code est la ligne def de wrap_fromfile ()
ci-dessous.
read_chpoint.py
import numpy as np
import array
import sys
'''
v0.5 Dec. 23, 2016
- wrap_fromfile() takes [num] arg
v0.4 Dec. 21, 2016
- read from "auxiliary" file [auxfp]
+ add read_auxiliary_info()
v0.3 Dec. 19, 2016
- add wrap_fromfile()
- read [inprodR],[prev_err],[resid_scale]
v0.2 Dec. 19, 2016
- fix bug > read [local_nRows] for "size_t" type
v0.1 Dec. 18, 2016
- read_chpoint_file() > read [ind_m],[local_nRows],[niter],[counter]
'''
def wrap_fromfile(rfp, typecode, num):
res = array.array(typecode)
...
Il y avait une ligne vide sous le commentaire, mais il semble y avoir deux lignes.
read_chpoint.py
import numpy as np
import array
import sys
'''
v0.5 Dec. 23, 2016
- wrap_fromfile() takes [num] arg
v0.4 Dec. 21, 2016
- read from "auxiliary" file [auxfp]
+ add read_auxiliary_info()
v0.3 Dec. 19, 2016
- add wrap_fromfile()
- read [inprodR],[prev_err],[resid_scale]
v0.2 Dec. 19, 2016
- fix bug > read [local_nRows] for "size_t" type
v0.1 Dec. 18, 2016
- read_chpoint_file() > read [ind_m],[local_nRows],[niter],[counter]
'''
def wrap_fromfile(rfp, typecode, num):
res = array.array(typecode)
res.fromfile(rfp, num)
...
Avec le correctif ci-dessus, l'erreur associée a disparu.
Courir
$ pep8 read_chpoint.py | head
read_chpoint.py:22:1: E101 indentation contains mixed spaces and tabs
read_chpoint.py:22:1: W191 indentation contains tabs
read_chpoint.py:23:1: W191 indentation contains tabs
read_chpoint.py:24:1: W191 indentation contains tabs
read_chpoint.py:26:1: E302 expected 2 blank lines, found 1
read_chpoint.py:27:1: W191 indentation contains tabs
read_chpoint.py:28:1: W191 indentation contains tabs
read_chpoint.py:28:35: E261 at least two spaces before inline comment
read_chpoint.py:28:36: E262 inline comment should start with '# '
read_chpoint.py:29:1: W191 indentation contains tabs
Recommended Posts