Skip to content

Commit 3008aab

Browse files
committed
Merge branch 'develop' of github.com:baidu/Paddle into feature/rename_fluid
2 parents 22662ae + cb17dd2 commit 3008aab

File tree

429 files changed

+6497
-4446
lines changed

Some content is hidden

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

429 files changed

+6497
-4446
lines changed

.copyright.hook

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,15 @@ def generate_copyright(template, lang='C'):
4949
LANG_COMMENT_MARK = "//"
5050

5151
lines = template.split(NEW_LINE_MARK)
52-
ans = LANG_COMMENT_MARK + " " + COPYRIGHT_HEADER + NEW_LINE_MARK
52+
BLANK = " "
53+
ans = LANG_COMMENT_MARK + BLANK + COPYRIGHT_HEADER + NEW_LINE_MARK
5354
for lino, line in enumerate(lines):
5455
if lino == 0 or lino == 1 or lino == len(lines) - 1: continue
55-
ans += LANG_COMMENT_MARK + " " + line + NEW_LINE_MARK
56+
if len(line) == 0:
57+
BLANK = ""
58+
else:
59+
BLANK = " "
60+
ans += LANG_COMMENT_MARK + BLANK + line + NEW_LINE_MARK
5661

5762
return ans + "\n"
5863

@@ -62,6 +67,8 @@ def lang_type(filename):
6267
return "Python"
6368
elif filename.endswith(".h"):
6469
return "C"
70+
elif filename.endswith(".c"):
71+
return "C"
6572
elif filename.endswith(".hpp"):
6673
return "C"
6774
elif filename.endswith(".cc"):
@@ -77,10 +84,13 @@ def lang_type(filename):
7784
elif filename.endswith(".proto"):
7885
return "C"
7986
else:
80-
print("Unsupported filetype")
87+
print("Unsupported filetype %s", filename)
8188
exit(0)
8289

8390

91+
PYTHON_ENCODE = re.compile("^[ \t\v]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)")
92+
93+
8494
def main(argv=None):
8595
parser = argparse.ArgumentParser(
8696
description='Checker for copyright declaration.')
@@ -89,9 +99,14 @@ def main(argv=None):
8999

90100
retv = 0
91101
for filename in args.filenames:
92-
first_line = io.open(filename).readline()
93-
if "COPYRIGHT" in first_line.upper() : continue
94-
original_contents = io.open(filename).read()
102+
fd = io.open(filename, encoding="utf-8")
103+
first_line = fd.readline()
104+
second_line = fd.readline()
105+
if "COPYRIGHT (C)" in first_line.upper(): continue
106+
if first_line.startswith("#!") or PYTHON_ENCODE.match(
107+
second_line) != None or PYTHON_ENCODE.match(first_line) != None:
108+
continue
109+
original_contents = io.open(filename, encoding="utf-8").read()
95110
new_contents = generate_copyright(
96111
COPYRIGHT, lang_type(filename)) + original_contents
97112
print('Auto Insert Copyright Header {}'.format(filename))

benchmark/paddle/image/alexnet.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
1+
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
22
#
3-
#Licensed under the Apache License, Version 2.0 (the "License");
4-
#you may not use this file except in compliance with the License.
5-
#You may obtain a copy of the License at
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
66
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# http://www.apache.org/licenses/LICENSE-2.0
88
#
9-
#Unless required by applicable law or agreed to in writing, software
10-
#distributed under the License is distributed on an "AS IS" BASIS,
11-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
#See the License for the specific language governing permissions and
13-
#limitations under the License.
14-
#!/usr/bin/env python
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
1514

1615
from paddle.trainer_config_helpers import *
1716

benchmark/paddle/image/googlenet.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
2-
#
3-
#Licensed under the Apache License, Version 2.0 (the "License");
4-
#you may not use this file except in compliance with the License.
5-
#You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
#Unless required by applicable law or agreed to in writing, software
10-
#distributed under the License is distributed on an "AS IS" BASIS,
11-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
#See the License for the specific language governing permissions and
13-
#limitations under the License.
141
#!/usr/bin/env python
152
from paddle.trainer_config_helpers import *
163

benchmark/paddle/image/provider.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
1+
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
22
#
3-
#Licensed under the Apache License, Version 2.0 (the "License");
4-
#you may not use this file except in compliance with the License.
5-
#You may obtain a copy of the License at
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
66
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# http://www.apache.org/licenses/LICENSE-2.0
88
#
9-
#Unless required by applicable law or agreed to in writing, software
10-
#distributed under the License is distributed on an "AS IS" BASIS,
11-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
#See the License for the specific language governing permissions and
13-
#limitations under the License.
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
1415
import io, os
1516
import random
1617
import numpy as np

benchmark/paddle/image/resnet.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
2-
#
3-
#Licensed under the Apache License, Version 2.0 (the "License");
4-
#you may not use this file except in compliance with the License.
5-
#You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
#Unless required by applicable law or agreed to in writing, software
10-
#distributed under the License is distributed on an "AS IS" BASIS,
11-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
#See the License for the specific language governing permissions and
13-
#limitations under the License.
141
#!/usr/bin/env python
152
from paddle.trainer_config_helpers import *
163

benchmark/paddle/image/smallnet_mnist_cifar.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
2-
#
3-
#Licensed under the Apache License, Version 2.0 (the "License");
4-
#you may not use this file except in compliance with the License.
5-
#You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
#Unless required by applicable law or agreed to in writing, software
10-
#distributed under the License is distributed on an "AS IS" BASIS,
11-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
#See the License for the specific language governing permissions and
13-
#limitations under the License.
141
#!/usr/bin/env python
152

163
from paddle.trainer_config_helpers import *

benchmark/paddle/image/vgg.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
2-
#
3-
#Licensed under the Apache License, Version 2.0 (the "License");
4-
#you may not use this file except in compliance with the License.
5-
#You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
#Unless required by applicable law or agreed to in writing, software
10-
#distributed under the License is distributed on an "AS IS" BASIS,
11-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
#See the License for the specific language governing permissions and
13-
#limitations under the License.
141
#!/usr/bin/env python
152
from paddle.trainer_config_helpers import *
163

benchmark/paddle/rnn/imdb.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
from __future__ import print_function
216
import six.moves.cPickle as pickle
317
import gzip

benchmark/paddle/rnn/provider.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
1+
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
22
#
3-
#Licensed under the Apache License, Version 2.0 (the "License");
4-
#you may not use this file except in compliance with the License.
5-
#You may obtain a copy of the License at
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
66
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# http://www.apache.org/licenses/LICENSE-2.0
88
#
9-
#Unless required by applicable law or agreed to in writing, software
10-
#distributed under the License is distributed on an "AS IS" BASIS,
11-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
#See the License for the specific language governing permissions and
13-
#limitations under the License.
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
1415
import io, os
1516
import random
1617
import numpy as np

benchmark/paddle/rnn/rnn.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
2-
#
3-
#Licensed under the Apache License, Version 2.0 (the "License");
4-
#you may not use this file except in compliance with the License.
5-
#You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
#Unless required by applicable law or agreed to in writing, software
10-
#distributed under the License is distributed on an "AS IS" BASIS,
11-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
#See the License for the specific language governing permissions and
13-
#limitations under the License.
141
#!/usr/bin/env python
152

163
from paddle.trainer_config_helpers import *

0 commit comments

Comments
 (0)