-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Using LoDTensor instead of Tensor in every operator. #4083
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
Conversation
|
|
||
| template <> | ||
| const std::vector<const Tensor*> InferShapeContext::MultiInput<Tensor>( | ||
| const std::string& name) const { |
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.
Specialized template function InferShapeContext::Input and InferShapeContext::MultiInput, thus, the InferShape of non-sequence operators can call Input<Tensor> to avoid to use LoDTensor.
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 specialization is great to hide the difference between LoDTensor and Tensor. I can also accept that we don't have this and expose LoDTensor to non-sequence operator contributors, because I feel that LoDTensor is a key difference from TensorFlow and could be a PaddlePaddle flag.
| } | ||
|
|
||
| template <> | ||
| std::vector<Tensor*> ExecutionContext::MultiOutput<Tensor>( |
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.
Redifined and specialized template function ExecutionContext::Output and ExecutionContext::MultiOutput, thus, the kernels of non-sequence operators can call Input<Tensor> and Output<Tensor> to avoid to use LoDTensor.
wangkuiyi
left a comment
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.
LGTM++
|
How to share LoD info in operator will be done in next PR, thus merged this PR. |
Fix #4047
Fix #3717
本地单测都通过: