Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于 Code Style 的几个建议 #973

Closed
wangkuiyi opened this issue Dec 20, 2016 · 2 comments
Closed

关于 Code Style 的几个建议 #973

wangkuiyi opened this issue Dec 20, 2016 · 2 comments
Assignees

Comments

@wangkuiyi
Copy link
Collaborator

wangkuiyi commented Dec 20, 2016

之前都没有顾上跟进Paddle 计算代码的改进。今天 Github Notifications 提醒我几个关于 function 的PR的更新,我在看PR之前先学习了一下 paddle/function 里的代码。有几个建议,请 @hedaoyuan 看看:

  1. 文件名命名模式不一致,比如有 TestMain.cpp 也有 cross_map_normal_op.cpp。建议按照 Google style,统一成 test_main.cpp。

  2. 在头文件 FunctionTest.h 里有 using directive,而且这个using directive是在global namespace里。虽然可能我们预期用户只在 unit test 里include这个头文件,但是实际上我们并没法控制用户不犯错误,为了安全,建议按照 Google style guide,从头文件里去掉这些 using directives。

  3. 和我们之前的习惯一样,所有的symbol都是定义在 namespace paddle 里的。建议确保 namespace 的名字和 目录名一致。在 paddle/function 里,symbols都应该定义在 paddle::function 里:

    namespace paddle {
    namespace function {
    
    class Tensor {
    ...
    }
    
    }  // namespace function
    }  // namespace paddle
    
@wangkuiyi
Copy link
Collaborator Author

希望这个比较新的package成为我们实践code style的范本。

@wangkuiyi wangkuiyi mentioned this issue Dec 20, 2016
@hedaoyuan
Copy link
Contributor

嗯,文件名那个,Paddle之前的都是大写,这个我先提个PR将小写的4个文件修改成大写的,如果统一换成小写可以另外写个ISSUE,跟整理编译工程一起做。另外,FunctionTest.h那个我提个PR修改一下。

wangxicoding pushed a commit to wangxicoding/Paddle that referenced this issue Dec 9, 2021
1. code fix: dataset_name -> file_name in predict.py
2. add default value for params_path in predict.py
3. remove misleading comments in train.py: we have no demo for ernie in the multi_label example.
4. remove unused imports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants