From 7840d181c9b84b25fad80a69c49cc09a29e158f2 Mon Sep 17 00:00:00 2001 From: peizhilin Date: Mon, 12 Nov 2018 11:49:13 +0800 Subject: [PATCH] fix style issue --- doc/v2/dev/contribute_to_paddle_en.md | 2 +- paddle/fluid/framework/data_type_transform.cu | 14 ++++++++++++++ paddle/fluid/framework/tensor_util.cu | 14 ++++++++++++++ paddle/fluid/platform/nccl_helper.h | 2 +- paddle/fluid/platform/variant.h | 2 +- python/paddle/fluid/__init__.py | 9 ++++----- python/paddle/fluid/layers/io.py | 5 +++-- python/paddle/fluid/layers/nn.py | 17 +++++++++++++---- python/paddle/fluid/layers/ops.py | 2 -- .../paddle/trainer_config_helpers/networks.py | 4 ++-- 10 files changed, 53 insertions(+), 18 deletions(-) diff --git a/doc/v2/dev/contribute_to_paddle_en.md b/doc/v2/dev/contribute_to_paddle_en.md index c97564d93a7..72723396444 120000 --- a/doc/v2/dev/contribute_to_paddle_en.md +++ b/doc/v2/dev/contribute_to_paddle_en.md @@ -1 +1 @@ -../../../CONTRIBUTING.md \ No newline at end of file +../../../CONTRIBUTING.md diff --git a/paddle/fluid/framework/data_type_transform.cu b/paddle/fluid/framework/data_type_transform.cu index f46491293ef..7dd9cb5cfd4 120000 --- a/paddle/fluid/framework/data_type_transform.cu +++ b/paddle/fluid/framework/data_type_transform.cu @@ -1 +1,15 @@ +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + data_type_transform.cc \ No newline at end of file diff --git a/paddle/fluid/framework/tensor_util.cu b/paddle/fluid/framework/tensor_util.cu index edd88c4e547..251c3a5e409 120000 --- a/paddle/fluid/framework/tensor_util.cu +++ b/paddle/fluid/framework/tensor_util.cu @@ -1 +1,15 @@ +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + tensor_util.cc \ No newline at end of file diff --git a/paddle/fluid/platform/nccl_helper.h b/paddle/fluid/platform/nccl_helper.h index cbe03c163f7..a6360a884d7 100644 --- a/paddle/fluid/platform/nccl_helper.h +++ b/paddle/fluid/platform/nccl_helper.h @@ -150,4 +150,4 @@ struct NCCLContextMap { } // namespace platform } // namespace paddle -#endif \ No newline at end of file +#endif diff --git a/paddle/fluid/platform/variant.h b/paddle/fluid/platform/variant.h index e9d90ac1ec5..1b10db8669f 100644 --- a/paddle/fluid/platform/variant.h +++ b/paddle/fluid/platform/variant.h @@ -49,4 +49,4 @@ limitations under the License. */ #define __builtin_expect(EXP, C) (EXP) #else #define UNUSED __attribute__((unused)) -#endif \ No newline at end of file +#endif diff --git a/python/paddle/fluid/__init__.py b/python/paddle/fluid/__init__.py index d3ad2149bc6..2e1b4b2ead3 100644 --- a/python/paddle/fluid/__init__.py +++ b/python/paddle/fluid/__init__.py @@ -112,11 +112,10 @@ def __bootstrap__(): os.environ['OMP_NUM_THREADS'] = str(num_threads) read_env_flags = [ - 'use_pinned_memory', 'check_nan_inf', 'benchmark', - 'eager_delete_scope', 'use_mkldnn', 'initial_cpu_memory_in_mb', - 'init_allocated_mem', 'free_idle_memory', 'paddle_num_threads', - 'dist_threadpool_size', 'eager_delete_tensor_gb', - 'reader_queue_speed_test_mode' + 'use_pinned_memory', 'check_nan_inf', 'benchmark', 'eager_delete_scope', + 'use_mkldnn', 'initial_cpu_memory_in_mb', 'init_allocated_mem', + 'free_idle_memory', 'paddle_num_threads', 'dist_threadpool_size', + 'eager_delete_tensor_gb', 'reader_queue_speed_test_mode' ] if os.name != 'nt': read_env_flags.append('warpctc_dir') diff --git a/python/paddle/fluid/layers/io.py b/python/paddle/fluid/layers/io.py index d50f6744dfc..a9075045a2d 100644 --- a/python/paddle/fluid/layers/io.py +++ b/python/paddle/fluid/layers/io.py @@ -348,6 +348,7 @@ def _copy_reader_create_op_(block, op): if os.name != 'nt': + @templatedoc(op_type='create_recordio_file_reader') def open_recordio_file(filename, shapes, @@ -405,8 +406,8 @@ if os.name != 'nt': startup_var.desc.set_dtypes(dtypes) startup_var.persistable = True - main_prog_var = _copy_reader_var_(default_main_program().current_block(), - startup_var) + main_prog_var = _copy_reader_var_( + default_main_program().current_block(), startup_var) if pass_num > 1: main_prog_var = multi_pass(reader=main_prog_var, pass_num=pass_num) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index c0278efb607..4b9264bfb6c 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -342,6 +342,7 @@ def embedding(input, if os.name != 'nt': + @templatedoc(op_type="lstm") def dynamic_lstm(input, size, @@ -961,6 +962,7 @@ def linear_chain_crf(input, label, param_attr=None): if os.name != 'nt': + @templatedoc() def crf_decoding(input, param_attr, label=None): """ @@ -988,9 +990,11 @@ if os.name != 'nt': dtype=helper.input_dtype()) helper.append_op( type='crf_decoding', - inputs={"Emission": [input], - "Transition": transition, - "Label": label}, + inputs={ + "Emission": [input], + "Transition": transition, + "Label": label + }, outputs={"ViterbiPath": [viterbi_path]}) return viterbi_path @@ -5530,8 +5534,13 @@ def label_smooth(label, if os.name != 'nt': + @templatedoc() - def roi_pool(input, rois, pooled_height=1, pooled_width=1, spatial_scale=1.0): + def roi_pool(input, + rois, + pooled_height=1, + pooled_width=1, + spatial_scale=1.0): """ ${comment} diff --git a/python/paddle/fluid/layers/ops.py b/python/paddle/fluid/layers/ops.py index df52b7042f4..66eb1229aa3 100644 --- a/python/paddle/fluid/layers/ops.py +++ b/python/paddle/fluid/layers/ops.py @@ -105,7 +105,6 @@ if os.name != 'nt': _cum_sum_ = generate_layer_fn('cumsum') - def cumsum(x, axis=None, exclusive=None, reverse=None): locals_var = locals().keys() kwargs = dict() @@ -115,7 +114,6 @@ if os.name != 'nt': kwargs[name] = val return _cum_sum_(**kwargs) - cumsum.__doc__ = _cum_sum_.__doc__ + """ Examples: diff --git a/python/paddle/trainer_config_helpers/networks.py b/python/paddle/trainer_config_helpers/networks.py index b5cde7bac77..1e961b936fc 100644 --- a/python/paddle/trainer_config_helpers/networks.py +++ b/python/paddle/trainer_config_helpers/networks.py @@ -1719,7 +1719,7 @@ def inputs(layers, *args): if len(args) != 0: layers.extend(args) - Inputs(*[l.name for l in layers]) + Inputs(* [l.name for l in layers]) def outputs(layers, *args): @@ -1769,7 +1769,7 @@ def outputs(layers, *args): assert len(layers) > 0 if HasInputsSet(): # input already set - Outputs(*[l.name for l in layers]) + Outputs(* [l.name for l in layers]) return # just return outputs. if len(layers) != 1: -- GitLab