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

add clip_by_norm op #5296

Merged
merged 5 commits into from
Nov 9, 2017
Merged

add clip_by_norm op #5296

merged 5 commits into from
Nov 9, 2017

Conversation

wwhu
Copy link
Contributor

@wwhu wwhu commented Nov 2, 2017

fix #4662
Clipping the gradient, only forward pass is needed.

framework::OpAttrChecker* op_checker)
: OpProtoAndCheckerMaker(proto, op_checker) {
AddInput("X",
"(Tensor)The input of clip_by_norm op."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a space between (Tensor) and The. Same as below doc.

(Tensor) The

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space is added.

using EigenVector = framework::EigenVector<T, MajorType, IndexType>;
template <typename T, int MajorType = Eigen::RowMajor,
typename IndexType = Eigen::DenseIndex>
using EigenScalar = framework::EigenScalar<T, MajorType, IndexType>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If EigenScalar is not used, it can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

ctx->SetOutputDim(framework::GradVarName("X"), x_dims);
}
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this Op has no gradient op, the ClipByNormOpGrad can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@wwhu wwhu merged commit 9185565 into PaddlePaddle:develop Nov 9, 2017
@wwhu wwhu deleted the clip_by_norm branch November 9, 2017 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clip_by_norm operator.
2 participants