-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[WIP] Backward #2949
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
Merged
Merged
[WIP] Backward #2949
Changes from 7 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
f35c8c4
remove simple_op_design.md
JiayiFeng 7dc53ea
renew simple_op_design.md
JiayiFeng 015ccd4
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
JiayiFeng 816b4c8
"add backward Op"
dzhwinter 9890b23
fix confilct
dzhwinter 8b80cf8
"add net op testing"
dzhwinter 7f1533f
test collaborating
JiayiFeng 855cae6
move unused file
dzhwinter e786746
Merge branch 'backward' of https://github.com/dzhwinter/Paddle into b…
JiayiFeng bf4da3d
Refactor Rigistry::CreateGradOp()
JiayiFeng cb95587
"ignore some gradient of specific op"
dzhwinter 94a6b1f
rename a macro
JiayiFeng 8bc4892
"fix comment "
dzhwinter 3dc70ff
Merge branch 'backward' of https://github.com/dzhwinter/Paddle into b…
JiayiFeng 73f4779
Merge remote-tracking branch 'origin/develop' into backward2
dzhwinter 4876f35
"make plainNet shared"
dzhwinter e192d0f
Refactor the implementation of gradient Op creating
JiayiFeng 14424f3
"use built-in operator"
dzhwinter 81a352a
"test fc without gradient"
dzhwinter 6f05392
Merge remote-tracking branch 'origin/develop' into backward2
dzhwinter 8a5ee46
Fix some compile errors
JiayiFeng b635af7
Fix some compile error
JiayiFeng 45452ac
Merge branch 'backward' of https://github.com/dzhwinter/Paddle into b…
JiayiFeng 088e220
"remove unused fake fc op"
dzhwinter 99a5904
Merge branch 'backward_dev' into backward
JiayiFeng f41fcd4
Merge branch 'backward' of https://github.com/dzhwinter/Paddle into b…
JiayiFeng 9418717
Fix compile errors
JiayiFeng 4736b23
Add a simple test for grad_op_creator
JiayiFeng f85ccdd
Renew CMakeList dependence
JiayiFeng 0ab8f52
Merge branch 'backward' of https://github.com/Canpio/Paddle into back…
JiayiFeng 380227b
Renew CMakeList dependence
JiayiFeng 5f3bc2a
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
JiayiFeng f4e2555
Fix compile error
JiayiFeng 81df39f
fix compile errer
JiayiFeng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. | ||
|
|
||
| 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. */ | ||
|
|
||
| #include <iostream> | ||
| #include "paddle/framework/op_registry.h" | ||
|
|
||
| namespace paddle { | ||
| namespace framework { | ||
| class FCOp : public OperatorBase { | ||
| public: | ||
| void Run(const ScopePtr& scope, | ||
| const platform::DeviceContext& dev_ctx) const override { | ||
| std::cout << "FC" << std::endl; | ||
| }; | ||
| void InferShape(const ScopePtr& scope) const override{}; | ||
| }; | ||
|
|
||
| class FCOpProtoAndCheckerMaker : public OpProtoAndCheckerMaker { | ||
| public: | ||
| FCOpProtoAndCheckerMaker(OpProto* proto, OpAttrChecker* op_checker) | ||
| : OpProtoAndCheckerMaker(proto, op_checker) { | ||
| AddInput("x", "input data"); | ||
| AddInput("w", "weights"); | ||
| AddInput("b", "bias"); | ||
| AddOutput("y", "output data"); | ||
| AddComment("Fully connnect op"); | ||
| } | ||
| }; | ||
|
|
||
| class FCGradientOp : public OperatorBase { | ||
| void Run(const ScopePtr& scope, | ||
| const platform::DeviceContext& dev_ctx) const override { | ||
| std::cout << "FCGrad" << std::endl; | ||
| }; | ||
| void InferShape(const ScopePtr& scope) const override{}; | ||
| }; | ||
|
|
||
| // class FCGradientOpProtoAndCheckerMaker : public OpProtoAndCheckerMaker {}; | ||
| REGISTER_OP(my_fc, FCOp, FCOpProtoAndCheckerMaker); | ||
| REGISTER_GRADIENT_OP(my_fc_grad, FCGradientOp); | ||
|
|
||
| } // namespace framework | ||
| } // namespace paddle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this method might be useless, we can directly invoke
OpRegistry::CreateGradOp(...)even that Op is a net.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true. I remembered that
AddBackwardOpis an interface forPlainNet, which generate the backward ops, then it can be used in Python. Remove it straightly is fine to me.